How to make input mandatory via javascrip

Asked

Viewed 54 times

-4

Pass me some study material, I heard you had a plug via jquery.. give me the necessary information that an imput is mandatory and appears an error. I tried the easy way required but it was not!

<input type="email" id="user_id" name="user_id" placeholder="" autocomplete="on" autocapitalize="none" spellcheck="false" autocorrect="off" class="andes-form-control__field" maxlength="120" autofocus="">
  • required didn’t work... Enter your code, please.

  • ready I already add

  • I did a test with the required and it worked, your input is inside a form (form)?

  • tells me exactly where to put the required so , something I’m missing or edit for me please!

1 answer

1

The required is inside the input, but your input must be inside a form, below an example, if you have doubt, take this excerpt and make a test:

<form>
  <input required type="email" id="user_id" name="user_id" placeholder="" autocomplete="on" autocapitalize="none" spellcheck="false" autocorrect="off" class="andes-form-control__field" maxlength="120" autofocus="">
  <input type="submit">
<form>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.