Poor Man's JQuery

What it lacks in flexibility and versatility, it makes up for in brevity.

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

from slide 44: coding while you commute

And here's the slightly less-poor poor man's jquery, updated for browsers in the modern age....

function $(selectors) {
    return document.querySelectorAll(selectors)
}

Note that this returns an array of elements.

External links

Source

results matching ""

    No results matching ""