How do i put condition that i password and confirm password must b same. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do i put condition that i password and confirm password must b same.

<!DOCTYPE html> <html> <head> <title>Login</title> <h1><hr align="center">Login</h1> </head> <body> <label><b> <hr align=30px> Name</b> </label> <br /> <textarea></textarea> <label><b><hr align=30px>Password</b></label><br /> <textarea></textarea> <label> <b> <hr align=30px> Confirm Password</b></label><br /> <textarea></textarea> <br /> <button ><align="center"></align><input type="Submit"></button> </body> </html>

14th Nov 2016, 1:54 PM
MSK
MSK - avatar
1 Answer
+ 1
You cannot do this only with html, html is markup language. It is not a programing language use PHP or javascript like, (i am using javascript) but you have created a good webpage, When I have learned html I was just a dull boy but you are much more intelligent than me. <!DOCTYPE html> <html> <head> <title>Login</title> <h1><hr align="center">Login</h1> </head> <body> <label><b> <hr align=30px> Name</b> </label> <br /> <textarea></textarea> <label><b><hr align=30px>Password</b></label><br /> <textarea id="pass"></textarea> <label> <b> <hr align=30px> Confirm Password</b></label><br /> <textarea id="conpass"></textarea> <br /> <button ><align="center"></align><input type="Submit" onclick="submits()"></button> <script> function submits() { var a = document.getElementById("pass").value; var b = document.getElementById("conpass").value; if(a==b) { //here write your own code after both are equal document.write("They are equal "+a+" "+b); } else { //here they are different alert("Please enter same thing in both password and confirm password box"); } } </script> </body> </html>
14th Nov 2016, 2:56 PM
Aditya kumar pandey
Aditya kumar pandey - avatar