I am trying to create a new user for my Parse database, but it is not working with forms and inputs. It only works if I hard code the value
<form>
First Name: <input type="text" id="firstName" />
<br><br>
Last Name: <input type="text" id="lastName" />
<br><br>
E-Mail: <input type="text" id="email" />
<br><br>
Password: <input type="password" id="email" /> <br>
</form>
<br><br>
<input type="button" value="Sign Up" onclick="signUp();" />
<script type="text/javascript">
Parse.initialize("xxxxxxxxx","xxxxxxxxxxx");
function signUp() {
var name = document.getElementById("firstName").value;
var pass = document.getElementById("password").value;
var mail = document.getElementById("email").value;
var user = new Parse.User();
user.set("username", name);
user.set("password", pass);
user.set("email", mail);
}
when setting the user instance variables, it works if I hard code the string as I said before, like this:
var user = new Parse.User();
user.set("username", "bob");
user.set("password", 1234);
user.set("email", "[email protected]");
I believe that something is going wrong when I call getElementById().value but I am not sure
Uncaught TypeError: Cannot read property 'value' of nullWhen I tried to get the value of the password input