www.webdeveloper.com
Results 1 to 3 of 3

Thread: Length of a specific item

  1. #1
    Join Date
    Jan 2013
    Posts
    2

    Length of a specific item

    I am newbie

    I have three elements
    <p>Content </p>
    <p> paragraph</p>
    <p>Content paragraph</p>

    I would like to know how I can access the length of the second paragraph

    document.getElementsByTagName("p")[1].length does not seem to work and I cannot find an answer in the book I am reading.

    Any help is appreciated

    Regards
    Corne

  2. #2
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,670
    Code:
    document.getElementsByTagName("p")[1].innerHTML.length

  3. #3
    Join Date
    Jan 2013
    Posts
    2
    Thank you sorry about the [code]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles