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(); Quote Link to comment 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>'); Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.