Just a quick tip how to handle using an UI object’s innerText property properly. Even today there are differences on how web browsers give you access to the ‘Text’ content of an HTML element. Let say you have the following html:
<p id=”mine”>This is some text</p>
To get the ‘content you must use the following:
IE and Chrome
mine.innerText
but in Firefox
mine.textContent
To make a ‘universal function to get this text you can use the following function:
function getInnerText(obj){
if (obj){
if (obj.innerText)
return obj.innerText;
else
return obj.textContent
}
else
return "";
}
0 Comments.