For example, I have the following code
<form>
<input type="text" required="true">
<input type="text" required="true">
<button type="submit">Click</button>
</form>
Guys, is it possible to set a default value "true" to the attribute "required"? Something like this:
<form required="true">
<input type="text">
<input type="text">
<button type="submit">Click</button>
</form>
The required option on input is removable by the user easily by inspecting the source code.
I think the best way to do that is to check all input with a javascript function call before sending the data like it's explain in the example bellow.
https://www.w3schools.com/js/js_validation.asp
Edit :
<form id="yourFormId">
..
</form>
And if you want you can use JQuery, just do :
$('#yourFormId').submit(function() {
// Something
return true; // True submit your form.
//return false; // False cancel your form.
});
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments