<html>
<head>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<script>
function checkValue() {
var id=$('#testValue').val();
if(id < 10){
$('#bb').text("value is LESS than 10. Disable Submit button please!");
$('#submitBtn').disabled = true;
}else{
$('#bb').text("value is MORE than 10. Enable submit button please!");
$('#submitBtn').disabled = false;
}
}
function testSubmit(){
alert('test submit clicked.');
}
</script>
input value:
<input type="text" id="testValue" maxlength="6" size="10" required>
<button type="button" name="action" onclick="checkValue()" value="issueInvoice">TEST VALUE</button>
<p style="text-align:left" class="txt-centered label-registersuccess font-red" id="bb"></p>
<button type="button" name="action" id="submitBtn" onclick="testSubmit()" value="issueInvoice">submit button</button>
</body>
</html>
I have this simple form. I input a value. If less than TEN, a text is shown, 'value less than 10'. I also want to disable the button on this condition. how do i do it? Then when value is more than TEN, a ''value more than 10 is shown' and button enabled.
how do i do this? $('#submitBtn').disabled = true;
does not work :(