lundi 31 août 2020

Setting Javascript to ignore an action on itself while still affecting other boxes (Beginner Javascript Coder)

I am creating a series of checkboxes in an interactive PDF, and I have added Javascript action to clear all other options once one is selected. Checkbox 1, once clicked, clears checkboxes 2 through 4.

I understand this is essentially a Radio button, but for the purpose of the PDF, the user needs to be able to unselect an option and to be able to clear all the options without adding a 'clear all' button.

The Javascript I'm adding is: this.resetForm(["name", "name1", "name2", "name3", "name4"]);

I'm wondering if there is additional code I could add, so the form ignores the reset action on itself?

With this, I could apply the Javascript to all the checkboxes at once instead of going in and adding the Javascript reset form to each individual checkbox.

Apologies if this question is really simple, I have little Javascript experience.

Thanks in advance, Marty




Aucun commentaire:

Enregistrer un commentaire