Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wrap(top, selector, bottom){
- var matches = document.querySelectorAll(selector);
- for (var i = 0; i < matches.length; i++){
- var modified = top + matches[i].outerHTML + bottom;
- matches[i].outerHTML = modified;
- }
- }
- wrap("<div class='wrapper'>", ".getWrapped", "</div>");
Add Comment
Please, Sign In to add comment