Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Nodelist forEach polyfill
- if (window.NodeList && !NodeList.prototype.forEach) {
- NodeList.prototype.forEach = function (callback, thisArg) {
- thisArg = thisArg || window;
- for (var i = 0; i < this.length; i++) {
- callback.call(thisArg, this[i], i, this);
- }
- };
- }
- // IEでも使える
- document.querySelectorAll('selector').forEach(function(element) {
- element.addEventListener('click', function() { /* */});
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement