I don't understand why my is not giving the value properly to my javascript variable. I have tried countless times, changing IDs and whatnot... still nothing... I searched everywhere for an answer... Please help
HTML SNIPPET
<form action="" method="post" onsubmit= "return validateForm()" class="registerform">
First Name: <input type="text" name="fname" id="fname"><br/>
Last Name: <input type="text" name="lname" id="lname"><br/>
Email: <input type="text" name="email" id="email"><br/>
Phone Number: <input type="text" name="phone" id="phone"><br/>
Password: <input type="password" name="password" id="myPass"><br/>
Confirm Password: <input type="password" name="confirmpassword" id="confirmPass"><br/>
<p><input type="submit" value="Submit"></p>
</form>
register.js
...
var password = document.getElementById("myPass").value;
var confirmPassword = document.getElementById("confirmPass").value;
...
function validateForm()
{
alert(password);
alert(confirmPassword);
error = '';
var fNamePass = validateFName();
var lNamePass = validateLName();
var emailPass = validateEmail();
var phonePass = validatePhone();
var passwordPass = validatePassword();
var passwordConfirmPass = validateConfirmationPassword();
...
in my alerts, the value keeps showing as null. Firebug shows me the value at null... I'm not new to JS, but I feel like I'm doing something really silly here, but my mind is not catching it...