jeudi 30 juillet 2015

Javascript to select all but the first checkbox on a page?

I want to be able to automatically mark all the checkboxes on a page EXCEPT the first one.

I have found a javascript snippet that selects all the checkboxes, that is currently working for that purpose, but I don't want it to select the first checkbox...

[].forEach.call(document.querySelectorAll('input[type="checkbox"]'), function (el) {el.checked = true});

I've tried various If statements within the above snippet, all of which break the process.

Any help will be appreciated. Note:(I am implementing this as a bookmarklet.)




Aucun commentaire:

Enregistrer un commentaire