On 9/6/06, Aljosa Mohorovic <[EMAIL PROTECTED]> wrote:
i have 5 checkbox items with same name:

<input name="geographic" value="1" type="checkbox">
<input name="geographic" value="2" type="checkbox">
<input name="geographic" value="3" type="checkbox">
<input name="geographic" value="4" type="checkbox">
<input name="geographic" value="5" type="checkbox">

and option to select multiple elements with same name must work.

$('#form_name').find("[EMAIL PROTECTED]@checked]") gives me only
one element.
how can i use checkbox elements like select tag?

Aljosa Mohorovic


Get all element with the geographic id by doing:

$('#geographic')

Then you can reference the DOM object as an array like:

alert($('#geographic')[4].value));

This should alert 5 which is the value of the fifth element in base 0 indexed array.

If you want to do something on all of the checkboxes with jQuery use:

$('#geographic').each(function {
    <yourFunctionHere>
   })

Hope this helps. :)

--
Shawn Tumey
Cofounder
MT Web Productions LLC
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to