InnerText and textConent usage in javascript

Now there major browsers always have some stuff different to make life of web developer horrible. On XP with latest IE, InnerText and textConent both work on chrome. Only textConent works Firefox whereas only InnerText works on Internet Explorer. So here is a con to make them work on all browsers.
if(document.all){
     document.getElementById('element').innerText = "my text";
} else{
    document.getElementById('element').textContent = "my text";
}
I haven't tested it on safari but I hope it work for all of you.

Comments

Popular posts from this blog

Switching from Notepad++ FTP to Visual Studio Code FTP

Simple PHP Script to read Tab Delimited File

jTable to edit and process MySQL table using CodeIgnitor : Part 2