HTML5 <input> required attribute but not inside <form> -
this question has answer here:
the required attribute works great inside form tags:
<form> <input type="text" name="user" required> </form>
but can use required attribute if cannot wrap form? outside of form input required not work me:
<input type="text" name="user" required>
i can replicate javascript id know if outside form possible
the "required" attribute works on form submit , since input has no form browser not know validate on submit.
what w3c says "required": when present, specifies input field must filled out before submitting form.
this possible js like:
document.getelementbyid('your_input_id').validity.valid
already discussed here 4 years ago:
Comments
Post a Comment