jquery - Autocomplete select option using ajax -


i have select , input. when select option input should load autocomplete data on value of each option.

<select>     <option class="selectoption" value="1">option 1</option>     <option class="selectoption" value="2">option 2</option>     <option class="selectoption" value="3">option 3</option>     <option class="selectoption" value="4">option 4</option> </select>  <input type="text" name="search"> 

as understood need add selected value in dropdown input box. here code see if fits requirement. html code

<select onchange="getval(this);">     <option value="option 1">option 1</option>     <option value="option 2">option 2</option>     <option value="option 3">option 3</option>     <option value="option 4">option 4</option> </select> <input type='text' title='tags' id='tags' value="option 1" /> 

javascript code

<script type="text/javascript">     function getval(sel) {     alert(sel.value);     var a=sel.value;     $("#tags").val(a);     } </script> 

and here demo link please see works need.demo_link


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -