3 ms·
did you ever try to debug your pretty jquery karate? ps. second example is not valid, in Vanilla JS you do it like this: document.getElementsByTagName('p').
by dotborg 14y ago
did you ever try to debug your pretty jquery karate?
ps. second example is not valid, in Vanilla JS you do it like this:
document.getElementsByTagName('p').filter(function(el) {
el.innerHTML = 'Hello.';
});
- Skalman 14y agoNope: TypeError: document.getElementsByTagName("p").filter is not a function Because you don't get an array, only something array-like.
- v413 14y agoThe right way is this :) Array.prototype.forEach.call(document.getElementsByTagName('p'), function(el) { el.innerHTML = 'Hello.'; });
- dasil003 14y agoI like how the end of that statement contains both a winking crooked-smile smiley next to black-eyed frown smiley.