how to get checkbox value in javascript [closed]

First off – don’t use the tag as it has been deprecated since 1999 use

<p style="font-weight:bold; color:green">....</p>

Instead of checkboxs use radio buttons

<input type="radio" name="red" value="red" onClick="myFunction(this.value);"> &nbsp; Red<br>

Repeat the above for all possible selections.
Change your function myFunction() to myFunction( value ) and work from there. The information is passed directly to the function so there is no need to go looking for it.

Leave a Comment