Skip to content

Instantly share code, notes, and snippets.

@dinnouti
Created October 7, 2012 16:27
Show Gist options
  • Save dinnouti/3848827 to your computer and use it in GitHub Desktop.
Save dinnouti/3848827 to your computer and use it in GitHub Desktop.
Replace input select with jquery ui autocomplete
asd = ->
$('.shipping').each ->
option = []
$(this).find('option').each ->
option.push $(this).text()
input = $('<input>')
input.attr('type','text')
input.attr('name', $(this).attr('name') )
input.attr('id', $(this).attr('id') )
input.attr('class', $(this).attr('class') )
$(this).replaceWith(input)
$(input).autocomplete({
source: option
});
asd()​​​
Shipping method:
<select id='shp_id' class='shipping' name="shipping_name">
<option value="1"> standard</option>
<option value="2"> 2-day</option>
<option value="3"> overnight</option>
</select>
<br />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment