Want to use javascript validation to work when i click submit button. What happens now is even if i enter a low value the value submits. but i need to check the validation before i click submit...
This is the Javascript:
$(function () {
$("#newMonoReading").on('focusout', function () {
var str = "";
var initialMonoReading = $('#InitialMonoReading').val();
var newMonoReading = $('#newMonoReading').val()
if (~~newMonoReading < ~~initialMonoReading) {
$('#MonoErrorMessage').text("New Mono Readings must be MORE than existing");
$('#MonoErrorMessage').show();
} else {
$('#MonoErrorMessage').hide();
}
});
});
Now on my form, you can see the input type (Submit)
<div class="modal-footer">
<input type="submit" value="Submit New Readings" class="btn btn-primary">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div>
</fieldset>
</form>
How do i get the JavaScript function to the submit button, so when i enter submit it wont work because i have entered a low value.
form, use a submit button.