Select elements based on class and element type
- by Beau Martínez
How can I select all elements within an HTML document with a specific class and specific element type?
I'm trying to select all anchors with the class title loggedin from an HTML document (and then open them within the browser). These are within parragraphs with the class title.
They are leafs in the following DOM tree:
+ body
+ div class='content'
+ div id='siteTable' class='sitetable linklisting'
+ div class='thing id-t3_xxxx xxx xxx link'
+ div class='entry unvoted'
+ p class='title'
+ a class='title loggedin '
Where x indicates variable content.
(I'm looking to do this in raw JavaScript, ie, not in jQuery.)