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, '');
}
0 comments:
Post a Comment