0

check code on my profile in html when I am making I form .then I need in email section when I don't put @ it's show's me error

Html form

31st Jul 2020, 12:12 PM
Suraj Bisht
Suraj Bisht - avatar
10 Answers
0
I just now mark it Your problem can be solved just by changing type:button; to type:submit; Check it.keep all same
31st Jul 2020, 12:49 PM
Divya Mohan
Divya Mohan - avatar
+ 1
For this you can use pattern attribute of input or can use js to show alert
31st Jul 2020, 12:31 PM
Divya Mohan
Divya Mohan - avatar
0
If you have input type email It's input must end with @----.com
31st Jul 2020, 12:18 PM
Divya Mohan
Divya Mohan - avatar
0
Will you pls tell me In detail that how can I solve my problem ?
31st Jul 2020, 12:23 PM
Suraj Bisht
Suraj Bisht - avatar
0
I am saying that when I am writing in my email section anything without @ then it's doesn't show me that you have to put @ , I want it that it shows me that you didn't put @ in your email
31st Jul 2020, 12:25 PM
Suraj Bisht
Suraj Bisht - avatar
0
If you want to put any random text in your email inputfeild just change the type:email ; to type:text;
31st Jul 2020, 12:25 PM
Divya Mohan
Divya Mohan - avatar
0
I didn't want to put any Random text ! I just want when I forgot to put @ it's will show me an error !!
31st Jul 2020, 12:28 PM
Suraj Bisht
Suraj Bisht - avatar
0
when the user click on sign in button, initiate a function and check if the email entered contains @ or not ,I am using regex to do so <input type="button" value="sign in " onclick="check()"> </form> <script> function check(){ var el=document.querySelector("#email"); var match=el.value.match(/@/); if(!match){ console.log("enter right email"); } }; </script>
31st Jul 2020, 12:30 PM
Abhay
Abhay - avatar
0
Okay dude Thanks 😊
31st Jul 2020, 12:31 PM
Suraj Bisht
Suraj Bisht - avatar
0
thanks Divya Mohan 😇😇 it worked đŸ€—đŸ€—
31st Jul 2020, 3:16 PM
Suraj Bisht
Suraj Bisht - avatar