Javascript function doesn't get called in html

Login Page
<form name="login">
Username: <input type="text" id="userid"/><br></br>
Password: <input type="password" id="pswrd/"><br></br>
<input type="button" onclick="check()" value="Login"/>
<input type="reset" value="Reset"/>
function check()
var userid=document.getElementById("userid").value;
var pswrd=document.getElementById("pswrd").value;
if(userid=="mano" &&  pswrd=="1234")
document.write("Hi bro");
alert("Error username or password")

Plz help me

Hi @Manohar123 !

Screenshots are hard to read.
Please write code directly into the forum.

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

plz check now

Your ids don’t match.

Double check your spelling in the HTML and make sure you are using the correct id names

remove the “/” from “pswrd”. then you are good to go

it worked man thank you

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