Help understand how to choose a jQuery attribute selector
3 answers
Since the space in the selector string is a descendant selector .
You will need to do:
$('#myid td.two[role=foo]') As you did, you were looking for <td role="foo"> elements that are descendants of .two .
+13
Do you want to:
$("#myid td[role=foo].two")... This selector:
$('#myid .two td[role=foo]') means: find the element with the identifier "myid". From it, find all descendants with the class "two". From these elements, find all descendant elements of <td> that have a role attribute with a value of "foo".
+2