HELP: I could not tell what is wrong with my code

HELP: I could not tell what is wrong with my code
0.0 0

#1

Hi guys! I am doing my final project for my coding class and I am trying to write an if-else statement in Javascript. I wrote one that works but then when I trying to do the same operation and did a little adjust then it is not working! Here is my code

The one that works!

Html:
		<button id="login" type="submit" class="btn btn-outline-success btn-sm"  onclick="myfunction1()" class="signin">Log In</button>

Script:
var onclick = document.getElementById("login")
function myfunction1() {
	let inputEmailEl = document.querySelector('#signinemail');
	let email = inputEmailEl.value;
	let inputPassEl = document.querySelector('#signinpsw');
	let password = inputPassEl.value;
	if ( password == "" || email == "")
		alert ('You must enter your information.')
	else {
		return 	location.href = "https://codepen.io/yn2329/live/yEEmKe";}
		 }

Here is the one that is not working, and when I use chrome inspect it tells me
" mKjKzy:277 Uncaught TypeError: Cannot read property ‘value’ of null
at myfunction2 (mKjKzy:277)
at HTMLButtonElement.onclick" I don’t understand why though,

Html:
<button id="signup" type="submit" class="btn btn-outline-light btn-sm" class="signup" onclick="myfunction2()">Sign Up</button>

Script:
var onclick = document.getElementById("signup")
function myfunction2() {
	let inputEmailEl = document.querySelector('#regemail');
	let email = inputEmailEl.value;
	let inputPassEl = document.querySelector('#regpsw');
	let password = inputPassEl.value;
	let inputRepeatPassEl = document.querySelector('#reregpsw');
	let repeatPassword = inputRepeatPassEl.value;
	if ( password == "" || email == "" || repeatPassword == "")
		alert ('You must enter your information.')
	else {
		return 	location.href = "https://codepen.io/yn2329/live/yEEmKe";}
		 }

Can anyone help me, the due is today!! Thanks you very much!


#2

Either your inputEmailEl or your inputPassEl is returning null. You probably have a spelling error.