Select elements based on class and element type
        Posted  
        
            by Beau Martínez
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Beau Martínez
        
        
        
        Published on 2010-05-10T10:51:12Z
        Indexed on 
            2010/05/10
            10:54 UTC
        
        
        Read the original article
        Hit count: 332
        
JavaScript
|dom
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.)
© Stack Overflow or respective owner