I've been trying to get my script to work for ages now, and it just won't have it! I'm trying to click all the 'unfollow button's on my Twitter/Following page after 5 seconds. Here's my code without the setInterval function:
var buttonArray = document.getElementsByClassName('w-button-mon w-button-unfollow'); for(var a=0;a<buttonArray.length;a++){ buttonArray[0].click(); }
Here's Twitters HTML DOM code for the unfollow buttons:
<span class="w-button-mon w-button-unfollow"><input alt="Follow" src=".gif" type="image"></span>
<input type="hidden" name="scribe_item" value="description=list&id=1875185790&item_type=3">
</form>
</td>
I'd be so appreciated if someone could amend my code! Thank you so much in advance!
I've been trying to get my script to work for ages now, and it just won't have it! I'm trying to click all the 'unfollow button's on my Twitter/Following page after 5 seconds. Here's my code without the setInterval function:
var buttonArray = document.getElementsByClassName('w-button-mon w-button-unfollow'); for(var a=0;a<buttonArray.length;a++){ buttonArray[0].click(); }
Here's Twitters HTML DOM code for the unfollow buttons:
<span class="w-button-mon w-button-unfollow"><input alt="Follow" src="https://ma.twimg./twitter-mobile/97bb0ca1daa74ae65fd470b1961897275eb91579/images/sprites/followchecked.gif" type="image"></span>
<input type="hidden" name="scribe_item" value="description=list&id=1875185790&item_type=3">
</form>
</td>
I'd be so appreciated if someone could amend my code! Thank you so much in advance!
Share Improve this question asked Oct 23, 2014 at 18:10 Declan LandDeclan Land 6502 gold badges11 silver badges28 bronze badges 03 Answers
Reset to default 5Using jquery you can use like this...
$('.w-button-mon.w-button-unfollow').click()
both of the class is on same element. So, it should not be any spaces in between the class
Change buttonArray[0].click()
to buttonArray[a].click()
.
The loop index is incorrect
buttonArray[0].click();
<<< mistake in the for loop
buttonArray[a].click();
will do the trick.