Wednesday, August 22, 2012

JQuery - looping through select options to string

If you have a HTML listbox from the <select><options> kind that's the easiest way I found to "export" the values to a string:


var str = $('#my_listbox_id option').map(function () { return $(this).val();}).get().join(', ');


Cheers!

No comments:

Post a Comment