I am trying to get an array of checkboxes that ARE checked AND have a certain attribute (tag) that is NOT blank.
(I know that the attribute called tag
is not HTML compliant but it does work across the major browsers and makes life alot simpler!)
e.g.
<input type="checkbox" name="First" tag="[email protected]" checked="checked">
<input type="checkbox" name="Second" tag="" checked="checked">
In the above example, only the first one should be in the array The code I have started with is:
$('input:checkbox:checked')
But that obviously doesnt ensure that the tag
attribute is not blank
UPDATE
Sorry, something I didnt think of before - I also need to get a list of the checkboxes whose tag
is blank so the user can be warned. The following dont work:
$('input:checkbox:checked[title=""]')
$('input:checkbox:checked:not([title])')
Thanks for all the responses, much appreciated!
UPDATE 2
The above code (using title
to store the additional data) doesnt work purely it seems because of the title atribute! When I changed it to tag
it worked perfectly.