I'm try to create a form with two input (Username and password) and one button(submit). my index.html code
<!DOCTYPE html>
<html>
<head>
<title>login</title>
</head>
<body>
<form>
<p>username</p>
<input type="text" id="username" />
<p>Password</p>
<input type="text" id="Password" /><br>
<button type="button" onclick="getinfo()">submit</button>
</form>
<script src="main.js"></script>
</body>
</html>
then adding some javascript code for just getting a username and password which enter in username and password field in html form. my main.js code
function getinfo(){
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
alert("Name = " + username + "password = " + password);
}
But i don't getting any alert. i'm try to find out but i can't understand why my code is not working.when i search internet i find some related post but unfortunately it did not help,it's maybe for my little understanding in javascript , but i need help about this.