K
K
kursof2017-08-08 16:53:28
JavaScript
kursof, 2017-08-08 16:53:28

How to insert value data into input, like in?

I want to get away with <select>and switch to inputautocomplete.

At the moment I have it in the search form.

<select  data-placeholder="Выберите город" name="search[city]" >
     <option value="">Выберите город</option>
     <option value="tokio">Токио</option>
    </select>

how do i insert a value value="tokio"into inputthe city names being passed!

var states = ['Киев', 'Москва', 'Токио'];
but you need, for example,

var states = ['kiev', 'moscow', 'tokio'];
what would be substituted into <input value="tokio"

the script given https://jsfiddle.net/mbaoe66f/

I used https://github.com/twitter/typeahead.js

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel Kornilov, 2017-08-08
@KorniloFF

https://jsfiddle.net/9prrzLq5/

L
lega, 2017-08-08
@lega

It's just an autocomplete, for what you want is select2, chosen, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question