Last active
October 5, 2015 08:47
-
-
Save benshimmin/2780772 to your computer and use it in GitHub Desktop.
One-liner to make DOM elements (like Backbone's; requires jQuery)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* usage: var $el = make("div", {"class" : "foo"}, "bar"); // -> <div class="foo">bar</div> */ | |
function make(t, a, c) { var e; return e = document.createElement(t), a && $(e).attr(a), c != null && $(e).html(c), e; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment