Home Search Member List Faq Register Login  
JavaScript Tips
Get inner text

Thread Starter: Karamasoft   Started: 09-18-2007 12:38 PM   Replies: 0
 Karamasoft Support Forums » General Discussions » JavaScript Tips » Get inner text
 Printable Version    « Previous Thread   Next Thread »
  18 Sep 2007, 12:38 PM
Karamasoft is not online. Last active: 3/7/2017 11:31:07 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,807
Get inner text

Internet Explorer provides an innerText property to get or set the text between the start and end tags of the object. Firefox does not provide an innerText property but a textContent property to get or set the inner text. For the browsers that do not provide a property to get or set the inner text, you can clear the HTML tags inside the innerHTML property.

function GetInnerText(elem) {

   return (typeof(elem.innerText) != 'undefined') ? elem.innerText :

          (typeof(elem.textContent) != 'undefined') ?   elem.textContent : elem.innerHTML.replace(/<[^>]+>/g, '');

}


  
 Page 1 of 1 (1 items)
Karamasoft Support Forums » General Discussions » JavaScript Tips » Get inner text

You can add attachments
You can post new topics
You can reply to topics
You can delete your posts
You can edit your posts
You can create polls
You can vote in polls
Forum statistics are enabled
Forum is unmoderated

© 2002-2017 Karamasoft LLC. All rights reserved.