Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Pretty sure cturhan did try jffry's code and that's why he wrote this code. The $ var on the page only returns the first instance that it matches so his code doesn't work.

A less efficient but shorter way is:

    var interval = setInterval(function(){
    	var links = document.querySelectorAll('#problems a');
    	for(var z =0; z< links.length; z++) {
    		$('#'+links[z].id).click();
    	}
    }, 1000);

Also he never called him stupid he simply informed him that it didn't work.


You're right, sorry - it was the supercilious tone I objected to. In fact $() returns the first element and clicks it. Because it's in a setInterval, it continues to click the first <a> it finds every 100ms. Did you try it?


Actually the oneliner does work. (Although it throws error when a is not found.)

A quick fix would be setInterval(function(){ $("a") && $("a").click() }, 100)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: