www.webdeveloper.com
Results 1 to 3 of 3

Thread: How to get the innerHTML in firefox

Hybrid View

  1. #1
    Join Date
    Apr 2012
    Posts
    2

    How to get the innerHTML in firefox

    First, i am a Noob.
    I wanna to get the content of the opened entry in Google Reader. I used the below command to get the div section.
    document.getElementById('current-entry').getElementsByClassName('item-body')
    and the below snapshot was the div section in firebug.
    Attachment 14766
    However, I cannot get the content by innerHTML or outerHTML or textContent.

    if i use
    var ib = document.getElementById('current-entry').getElementsByClassName('item-body') ;
    var tc = ib.getElementsByTagName('p')
    the firebug return the error ib.getElementsByTagName is not a function.

    Can you help me?

  2. #2
    Join Date
    Nov 2010
    Posts
    978
    getElementsByClassName('') (which by the way is not supported in all browsers) will return a collection, as will getElementsByTagName(''), so what you are looking for is probably something like this:

    Code:
    var ib = document.getElementById('current-entry').getElementsByClassName('item-body')[0]
    var tc = ib.getElementsByTagName('p')[0]
    alert(tc.innerHTML)
    but those [0]'s depend on how your page is structured

  3. #3
    Join Date
    Apr 2012
    Posts
    2
    Thank you very much.

    the [0] really work,haha!

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