Javascript Shorthand for getElementById

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.



comments powered by Disqus


Recent Tweets

Maybe resolved itself, after resetting emulator and couple restarts - will let you know
@MillerMark A few weeks ago you tweeted that something huge/incredible was coming....what is/was it? (I am hoping s……
Oddly, it won't hit breakpoints in XF .net standard 2 project now either
@JamesMontemagno Updated to 15.7 preview 2 Visual Studio - now having lots of odd thread issues when starting debug……