errx
errx

Reputation: 1791

how to group multiple filter selectors?

How can I select first checked checkbox from div with class "site"?

I guess it should be something like that but this doesnt work:

$(".site :checkbox :checked :first")

Upvotes: 1

Views: 1181

Answers (4)

T Nguyen
T Nguyen

Reputation: 3415

remove the spaces

$(".site :checkbox:first:checked")

Upvotes: 2

Aziz Shaikh
Aziz Shaikh

Reputation: 16524

$(".site :checkbox")[0].checked);

Demo: http://jsfiddle.net/nyus6/

Upvotes: 0

Sotiris
Sotiris

Reputation: 40066

$(".site input[type='checkbox']:checked:first")

Demo: http://jsfiddle.net/TRAk2/

Use the Attribute Equal Selector to select the type of an input.

Upvotes: 2

ThiefMaster
ThiefMaster

Reputation: 318518

Use $('.site input:checkbox:checked:first")

It searches for input tags that are checked checkboxes below .site and then returns the first element that matches these criteria.

Upvotes: 2

Related Questions