2nd time searching for how to refresh select box using javascript / jquery. I’ve found the solution previously but the code is hidden somewhere else… grrr… Just a note for myself to refer how to refresh select box using javascript / jquery. Hope this helps u too!
To refresh select box using jQuery, refer to the code below:-
Advertisements
// Assuming there is a select box with ID = myselectbox // this will clear all select box item $('#myselectbox').children().remove().end(); var s = document.getElementById('myselectbox'); // add item to select box s.options[s.options.length] = new Option('', ''); s.options[s.options.length] = new Option('Label 1 here', 'value 1 here'); s.options[s.options.length] = new Option('Label 2 here', 'value 2 here');
Related posts:
How to detect checkbox being checked using javascript
How to validate drop down list in Javascript?
Javascript: open new window with window.open()
How to delete table row using jQuery
WordPress: How to open rss links in new window?
jQuery: disable autoscrolling to top when click on anchor
Easy to use jQuery Lightbox - Fancybox
Javascript: Prevent page from frameset hijack
Share this with your friends:-