-1

HTML:

<form id="myform"  method="post">
    <input name="email"  type="email" required=""/>
    <input name="fname" type="text" required="" />
    <input name="zip" type="text" />
    <input  type="button" value="button" />
</form>

Here I want to just check email by applying javascript function for html5 can we do that?

Edit
It has been unclear/misunderstood before. My question is do we have boolean valid check like form.email.valid() so that we can do check for email only with using javascript?

1

1 Answer 1

2

You should change your button input. A HTML5 submit button needs to look like the following:

<button type="submit">Submit</button>

Also, giving your e-mail a placeholder would be nice:

<input name="email" type="email" placeholder="[email protected]" required=""/>

Example jsFiddle.

Sign up to request clarification or add additional context in comments.

5 Comments

I need to call by not submitting the form or I may need to check the validity of just email .
@vusan Have you tried the jsFiddle? it already validates whether it's an e-mail or not
ok now can we use like $('#form')[0].checkValidity() with pure javascript.
Check this link has a accepted answer, to the "same" question, just submit and preventDefaults.
@vusan Yep! check out the link that winner_joiner posted for that

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.