31 October 2011

Reduce Javascript code with simple function

I am using this function when i write javascript code. In steads of writing document.getElementById ever time i use this function $.

function $(id){
return document.getElementById(id);
}

Instead using document.getElementById you can use $.



document.getElementById('id').value;




$('id').value;
About Editorial Staff
Nathan Shri is a Web Developer ,Opensource lover,and the editor of the codingwoo based in India ,who loves to learn new stuffs and and share.You can be his friend on Facebook.

Post a Comment