JQuery form not submitting

Although I have some different requirement, but why the form is not submitting?
Alert is not functioning?

Hi @codeispoetry, a button with type="button" won’t submit the form; you’d need a button with type="submit" (or no type attribute at all as this is also the default).

1 Like

Hi there, Can you guide me which JQuery functions should I look for to accomplish:

  1. Get a submit click event w/o using that submit handler +
  2. Check if the email is entered in the correct format. Any JQuery function for that.

Thanks.

Now which event do you want to listen to, submit or click? Anyway you can to listen to either like so:

$('form').on('submit', console.log)
$('button').on('click', console.log)

jQuery itself doesn’t have email validation capabilities AFAIK, however the vanilla constraint validation API does:

<input type="email" placeholder="Enter your email here">
$('input').on('input', function () {
  $(this).toggleClass('error', !this.validity.valid)
})
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.