[jQuery] jqMultiSelects suggestion

[jQuery] jqMultiSelects suggestion


Hey Rob,
Thanks for jqMultiSelects. Useful one. :)
One suggestion: let the user decide the selectors that will be used
for the elements, instead of forcing an ID. I modified it to allow
this:
jQuery.fn.multiSelect = function(to, button) {
return this.each(function() {
var select = this;
jQuery(this).dblclick(function() {
moveOptions(select, to);
});
if (typeof button != "undefined") {
jQuery(button).click(function() {
moveOptions(select, to);
});
}
});
function moveOptions(from, to) {
jQuery(from).children("option:selected").each(function() {
jQuery(this)
.attr("selected", false)
.appendTo(to);
});
}
};
Then it can be called like this:
$("#select_left").multiSelect("#select_right", "#options_right");
$("#select_right").multiSelect("#select_left", "#options_left");
Don't you think it is less restrictive?
-- rodrigo