FormValidation


Javascript Code <script type=”text/javascript”>function validate() { if ((!document.getElementById(‘gender’).checked) && (!document.getElementById(‘genderf’).checked))    {        alert(“select gender”);    }}</script> HTML Code <form name=”form” id=”form” method=”post” onsubmit=”validate();”>    <input type=”checkbox” name=”check” id=”tnc” /> I accept all terms and conditions.<br/>      Male <input type=”radio” name=”gender” value=”male” id=”gender” class=”gender” />    Female […]

check if checkbox is checked or not in javascript


validation of file extension before uploading file in javascript HTML CODE <form method=”post” onsubmit=”validate(this);”>    <input type=”file”>    <input type=”submit” value=”submit”></form> JAVASCRIPT CODE function validate(ranvirForm){    var allowedExtentions = [“.jpg”, “.jpeg”, “.pdf”, “.png”];  // allowed extenstions array    var input_arr = ranvirForm.getElementsByTagName(“input”);    for (var i = 0; i < […]

validation of file extension before uploading file in javascript