Skip to content

Instantly share code, notes, and snippets.

@jemise111
Created January 13, 2015 18:57
Show Gist options
  • Save jemise111/eeddc9899c7a4ca77245 to your computer and use it in GitHub Desktop.
Save jemise111/eeddc9899c7a4ca77245 to your computer and use it in GitHub Desktop.
jqlite helper
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