SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Evangelist JordashTalon's Avatar
    Join Date
    Dec 2008
    Posts
    505
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Selecting Every div inside of a class

    I have something like this:

    <div class="someClass">

    <div>text</div>
    <div>text</div>

    </div>

    I want to apply a class to every div within the someClass div

    How would I do something like that?

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Gain a reference to the <div class="someClass"> element. use something like getElementsByClassName()

    Then, you can find the descendant divs of that element via
    myDivReference.getElementsByTagName("div")


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •