mouse
mouse

Reputation: 31

dojo query for checkboxes

I want to get all my checked checkboxes from a form and i do like this(and it works)

var cbs = dojo.query('input:checked', 'f');

I wand to add another selector(class selector) to get all checked checkboxes from a form with a specified class. I tried this one but it doesn't work

 var cbs = dojo.query('input:checked .xClass', 'f');

Upvotes: 3

Views: 3802

Answers (2)

Sean Haggerty
Sean Haggerty

Reputation: 79

What does the 'f' do in this case? I tried google for the parameters but couldn't find anything. – user1477388 Oct 11 '13 at 16:20

the second parameter of the query is the starting node for the query.

For instance, the query for < input > tags begins at "#{id:inputText1}" followed by the found nodes having the value of those found nodes, smited away with a null string.

enter image description here

Upvotes: 0

Fu Cheng
Fu Cheng

Reputation: 3395

Try this dojo.query('input.xClass:checked', 'f');

Pseudo-selectors like :checked act like filters and should be put as suffixes of other selectors. You can select checkboxes with a specified class first using input.xClass, then append the :checked as the suffix.

Upvotes: 6

Related Questions