Custom Signup Page with Redirect after Signup

i have simillar issues i am having results like: The element selector function (usually $w) cannot be used before the page is ready

thats the code for my signup Form… i need reply asap please i need help

please help

$w(‘#SignupRegisterButton’).onClick(() => {
$w(‘#SignupEmailInput’).value, $w(‘#SignupPasswordInput’).value, {
“contactInfo”: {
“firstName”: $w(‘#SignupFirstNameInput’).value,
“lastName”: $w(‘#SignupLastNameInput’).value,
“FirstName”: $w(‘#SignupFirstNameInput’).value,
“LastName”: $w(‘#SignupLastNameInput’).value,
“accountName”: $w(‘#SignupAccountNameInput’).value,
“signupEmail”: $w(‘#SignupEmailInput’).value,
“password”: $w(‘#SignupPasswordInput’).value,
“confirmPassword”: $w(‘#SignupconfirmPasswordInput’).value,
“phoneNumber”: $w(‘#SignupPhoneNumberInput’).value,
“AccountName”: $w(‘#SignupAccountNameInput’).value,
“accountNumber”: $w(‘#SignupAccountNumberInput’).value,
“packages”: $w(‘#SignupPackagesDropdown’).value
}
.then(() => {
//Everything went good, user was registered, now going to redirect
console.log(‘user registered successfully’);
wixLocation.to(‘/Merge’);
}). catch ((err) => {
//If there is an error it will not redirect, it will console.log the error
console.log(${err}: Error)
})
});