I have a wordpress theme using autocomplete suggestion by getJSON,suggestion call into a drop down option like below
I want save the ID and value of the selected option into a variable, How can i do it please help.
Thanks
I have a wordpress theme using autocomplete suggestion by getJSON,suggestion call into a drop down option like below
I want save the ID and value of the selected option into a variable, How can i do it please help.
Thanks
If you are using jquery then you can use attr()
Check the documentation http://api.jquery.com/attr/
try this code:
$('#element option:selected').attr('id');