there is a checkbox and radio in this form, can you tell me how to validation through javascript
how to validation in javascript ? there is a checkbox/radio in this form, how to validation through javascript <!DOCTYPE html><html><body> <form action="#" method="post"> <table> <tr> <td>Name :</td> <td> <input type = "text" name="name" id="name"/> <span id="nameSpan"> </span> </td> </tr> <tr> <td> <input type="radio" name="gender" id ="gender" value="male"/> Male <input type="radio" name="gender" id="gender" value="female"/> Female <span id="genderSpan"></span> </td> </tr> <tr> <td><input type="checkbox" name="tnc" id="tnc"/> <span id="tncSpan"></span></td> <td><sup>*</sup>T & C</td> </tr> <tr> <td colspan="2"> <center> <input type="submit" value="Submit" onclick="return valid()"/> <button type="reset" value="Reset" >Reset</button> </center> </td> </tr> </table> </form> <script> function valid(){ var name = document.getElementById("name").value; var gender = document.getElementById("gender").value; var tnc = document.getElementById("tnc").value; if( name ==="" || name===null){ document.getElementById("nameSpan").innerHTML="Enter your name"; return false; } if (gender ==="" || gender===null){ document.getElementById("nameSpan").innerHTML=""; document.getElementById("genderSpan").innerHTML="Select the options"; return false; } if (tnc==="" || tnc===null){ document.getElementById("genderSpan").innerHTML=""; document.getElementById("tncSpan").innerHTML="Tick the T&C"; return false } } </script> </body> </html> not workin