I created this simple form with a text box, check box, select option list and a Submit button using html. By default submit button is disable. After user fills all the text box and select a option from the select box and check the check box, submit button must be enable. How can I do with java script. Thank you. Here is my code,
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <form> <input type="text" id="u-name" name="username" placeholder="Username" /><br/><br> <input type="text" id="u-age" name="age" placeholder="Age" /><br/><br> <select id="u-type"> <option>Choose</option> <option>Type 1</option> <option>Type 2</option> <option>Type 3</option> </select> <br> <br> <label class='checkbox-inline'> <input type='checkbox' name='c-box' id='c-box'>Check Me </label> <br> <input type="submit" id="Save" value="Save" disabled /> </form> </body> </html>
onchangeof each of the inputs checking for if they'll all filled in, if so, setdisabledon the final button to befalserequiredto use the browser validation. This also prevents sending without values.