shortcut for document.getElementById

Shortcut for the document.getElementById function, it helps to reduce the code and is easier to remember than the full name.


gEle = function(a){
	return ( (typeof a==="string") ? document.getElementById(a) : a );


a (string of text or object)
The string with the id of the object or one DOM object, this second option is for the use with jQuery

Returned value

The DOM object with the given id or null if not exist

Leave a Reply

Your email address will not be published. Required fields are marked *