April 4, 2013

Code Snippet: getById

In a simple JavaScript project that does not use JQuery or other third-party libraries, I find this to be a nice shortcut for document.getElementById():

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

No comments:

Post a Comment