mga_ka_php Posted May 17, 2011 Share Posted May 17, 2011 how do i write this in jquery? var state = document.getElementById("state"); state.options[state.options.length] = new Option(); Link to comment https://forums.phpfreaks.com/topic/236614-how-to-convert-this-to-jquery/ Share on other sites More sharing options...
anupamsaha Posted May 17, 2011 Share Posted May 17, 2011 Try this: $('#state').append('<option value="foo" selected="selected">Foo</option>'); Link to comment https://forums.phpfreaks.com/topic/236614-how-to-convert-this-to-jquery/#findComment-1216392 Share on other sites More sharing options...
anupamsaha Posted May 17, 2011 Share Posted May 17, 2011 Also, there is a good article that I found here http://www.electrictoolbox.com/jquery-add-option-select-jquery/. Might be a help for you. Link to comment https://forums.phpfreaks.com/topic/236614-how-to-convert-this-to-jquery/#findComment-1216393 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.