The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> PROBLEM WITH DISABLING SUBMIT BUTTON TILL ALL INPUTS FILLED
shankar from vizag
post May 28 2019, 09:12 AM
Post #1


Advanced Member
****

Group: Members
Posts: 166
Joined: 18-June 13
Member No.: 19,316



Greetings,

I have a form with input fields. I would like to disable submit button till all input fields of the form entered.

I placed the code below and it is not working.

<head>
<script>

$(document).ready(function (){
validate();
$('#notenum, #note_date).change(validate);
});

function validate(){
if ($('#notenum').val().length > 0 &&
$('#note_date').val().length > 0) {
$("input[type=submit1]").prop("disabled", false);
}
else {
$("input[type=submit1]").prop("disabled", true);
}
}

</script>
</head>


<center><table class = "table table-striped table-bordered table-hover table-condensed" >
<tr class="active"><td align="right">Note Number:</td><td><input type = "text" readonly name="notenum"> </td></tr>
<tr><td align="right">Date:</td><td><input type="text" id="myDatepicker" name="note_date" placeholder="Click to pick date" ></td></tr>
</table></center>
<input class ="btn btn-primary" type="submit" id="submit1" name="submit1" value="SAVE" onsubmit='this.disabled = true;'>i


Request to guide me to fix the problem. Thanks in advance.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 17th November 2019 - 04:51 AM