A
A
Artyom2016-01-25 23:41:44
JavaScript
Artyom, 2016-01-25 23:41:44

How to change selector in jQuery for AutoComplete in Yii2??

There is a field with autocomplete,
there is a result:

jQuery(document).ready(function () {
jQuery('#registrationform-city').autocomplete({"source":"\/site\/autocomplete","autoFill":true,"minLength":"0","select":function(event, ui) {
      }});


<div><?= $form->field($model, 'city')->widget(
            AutoComplete::className(), [
            'clientOptions' => [
                'source' => Url::to(['site/autocomplete']),
                'autoFill' => true,
                'minLength' => '0',
                'select' => new JsExpression('function(event, ui) {

                             }')

            ],
            'options' => [
                'class' => 'form-control',
                'placeholder' => Yii::t('app', 'Start typing the name')
            ]
        ]); ?>

how to change #registrationform-city to another selector?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander N++, 2016-01-25
@Shumerok

try setting the id property of the widget

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question