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:
Javascript: Prevent page from frameset hijack
jQuery: disable autoscrolling to top when click on anchor
Javascript: open new window with window.open()
WordPress: How to open rss links in new window?
How to detect checkbox being checked using javascript
How to delete table row using jQuery
How to validate drop down list in Javascript?
Easy to use jQuery Lightbox - Fancybox
Share this with your friends:-