- April 20, 2015
In the following sample I define a variable byId and set it to the function. You can use any valid variable name in place of byId
var byId = function( id ) {
return document.getElementById( id );
};
byId( 'someID' )
With jQuery simply $('#{id}) works as well.