A page has lots of links in it and I need to quickly click the links with text "Delete" in it. This causes AJAX request so a little pause is needed. What would be the javascript bookmarklet code (with no libraries, e.g. jQuery) which will quickly call the onclick() event binded to the links directly as an attribute but only those with text "Delete"?
As far as I can do it myself I get:
javascript:
(function(){
var links = document.getElementsByTag('a');
for(var i = 0; i <= links.length; i++){
if(links[i].innerHTML == "Delete"){
setTimeout("links[i].onclick()", 500); // pause for previous AJAX to proceed
}
}
})();