Created
January 13, 2015 18:57
-
-
Save jemise111/eeddc9899c7a4ca77245 to your computer and use it in GitHub Desktop.
jqlite helper
This file contains 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
function applyToElements(selector, callback, context){ | |
var elements = document.querySelectorAll(selector); | |
for(var i=0; i < elements.length; i++){ | |
callback.call(context, elements[i]); | |
} | |
} | |
function addPropertyToElements(selector, property, value){ | |
applyToElements(selector, function(el){ | |
el[property] = value; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment