Warning If Required Inputs Are Not Selected
How can I add a warning to #printpage when its disabled if its chosen saying please check required fields? I have tried to add an onclick handler. The printpage button does not sh
Solution 1:
You can use JS function checkValidity(), this will return false if the form is not valid.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/checkValidity
isValid = $('.form').checkValidity()
if (!isValid) {
$('#printpage').innerText = "Please fill in required fields";
} else {
$('#printpage').innerText = "";
}
Your html should contain HTML validity checkers, such as required.
<input required type="text"class="thisIsAClass" />
Post a Comment for "Warning If Required Inputs Are Not Selected"