Select box manipulation with jQuery
If you read the jQuery mailing list, you may be aware that I have updated my plugins for working with select boxes. Summary of changes:
- addOption replaces any options with the same value (so think of it as an add/replace options plugin
- selectOptions selected options in addition to what was already selected, but there is now an option for it not to do this
- There are two new methods:
- copyOptions which is for copying options between select boxes
- ajaxAddOption allows you to add options via AJAX (i.e. could be used for create options dynamically from a server script)
Comments
So, does it make sense to add some functionality to removeOption to be able to remove everything and then call ajaxAddOption to add in the new options?
$("#myselect").removeOption(/./).ajaxAddOption ("myoptions.php");