I'm trying exactly the same. $("input:checkbox:checked"); returns a set of jQuery elements $("input:checkbox:checked").val(); returns the value of the first element in the set.
I really wanted to get an array with all the values, or even a string, without the need to iterate over each of the elements. Thanks jeangougou wrote: > > > Updating jQuery to 1.2 gives you all the values, as you can see here: > http://docs.jquery.com/Attributes/val > else you can use a plugin > http://www.malsup.com/jquery/form/#fields > > pay attention for the result, it might be an array. i haven't checked > that yet. > Good luck > > Duncan ha scritto: > >> All, >> >> I am lost right now, still pretty green with jQuery. I have a number of >> checkboxes on a page >> >> <input type="checkbox" name="listProductID" value="2"> >> <input type="checkbox" name="listProductID" value="3"> >> <input type="checkbox" name="listProductID" value="4"> >> <input type="checkbox" name="listProductID" value="5"> >> >> and a button at the end. >> >> <button name="editOptions" id="editOptions">Edit </button> >> >> I would like to have the value of alll checked checkboxes put into a list >> for use in a variable. >> >> how would I go about this? >> >> $().ready(function() { >> $('#editOptions').click(function(){ >> alert($('#listProductID').val());//returns only the first >> value, >> selected or not >> }); >> }); >> >> Thanks >> >> -- >> Duncan I Loxton >> [EMAIL PROTECTED] > > -- View this message in context: http://www.nabble.com/get-value-of-checked-checkboxes-into-a-list-tp14750244s27240p15906685.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.