Arturas Rosenbacher Arturas Rosenbacher - 1 year ago 100
Javascript Question

Click all buttons via JS

var inputs = document.getElementsByClassName('minds-subscribe-button');

for (var i=0; i<inputs.length;i++)

That code works to click both buttons -
<button class="minds-subscribe-button">
<button class="minds-subscribe-button subscribed">

I don't want to click the buttons that have
"minds-subscribe-button subscribed"
, only

Answer Source

Inside your for loop, you could execute:


It will verify if the input hasn't the class subscribed. If it's true, then click.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download