samedi 28 juillet 2018

Show sum of values for all checkboxes that are checked

I’m creating an HTML form and want to achieve the following with JS, please provide the code i should use to do so.

1.Add values of all the checked checkboxes and show them as total.

2.Add a restriction the user must select at least 2 checkboxes. Here is my code.

<input class="iput" type="checkbox" name="E33" value="4500" />
<input class="iput" type="checkbox" name="E34" value="3000" />
<input class="iput" type="checkbox" name="E36" value="6000" />

<p>Your Total is = </p>

Also code should be such that if i add or remove checkboxes i should not have to modify the JS code too.




Aucun commentaire:

Enregistrer un commentaire