Reputation: 143
i'm trying to understand how does following any-attribute-selector
works...
$('td[abbr="Role"] >div')
the main question is: does this selector choose dom element
and the second question is how selector recognize string after closing bracket
] >div'
and the last question is there any site like http://jsfiddle.net/ where i could see the element which was found by selector. in jsfiddle.net i guess i can't see and find and be sure that i've found the particular element. Because jsfiddle as any other browser just finds element behind the scenes.
Upvotes: 0
Views: 211
Reputation: 13185
$('td[abbr="Role"] >div')
Selects all direct child div
elements of the element td
with abbr
attribue equal to Role
Upvotes: 0
Reputation: 17945
As @RaraituL recommends, use the Firebug extension for Firefox (or the Developer Tools integrated in Chrome; it is essentially an integrated Firebug) to get a working JS console; and then debug your expressions by writing
var result = $(my_selector); console.log(result);
in the console. The output will be something like
Object[match1, match2, match3]
and you will be able to click on each of these to see where it is in the page, and what are its attributes.
Upvotes: 1