need help with multiple checkbox on registration page..

here is my code…

import wixUsers from ‘wix-users’;
import wixLocation from ‘wix-location’;
$w.onReady(function () {
$w(’ #registerbutton ‘).onClick(function () {
let email = $w(’ #email ‘).value;
let password = $w(’ #password ‘).value;
wixUsers.register(email, password)
.then(() => {
wixLocation.to (’/testing’);
})
})
})
export function ps4checkbox_click_1(event) {
" #PS4 "();
}
export function pccheckbox_click_1(event) {
" #PC "();
}
export function xboxcheckbox_click(event) {
" #XBOX “();
}
export function nintendoswitchcheckbox_click(event) {
“NintendoSwitch”();
}
export function mobilecheckbox_click(event) {
“Mobile”();
}
function pccheckbox() {
if ($w(” #pccheckbox “).value === ‘’) { $w(” #pccheckbox “).value = ‘PC’; } else { $w(” #pccheckbox “).value = ‘’; }
if ($w(” #ps4checkbox “).value === ‘’) { $w(” #ps4checkbox “).value = ‘PS4’; } else { $w(” #ps4checkbox “).value = ‘’; }
if ($w(” #xboxcheckbox “).value === ‘’) { $w(” #xboxcheckbox “).value = ‘XBOX’; } else { $w(” #xboxcheckbox “).value = ‘’; }
if ($w(” #nintendoswitchcheckbox “).value === ‘’) { $w(” #nintendoswitchcheckbox “).value = ‘NintendoSwitch’; } else { $w(” #nintendoswitchcheckbox “).value = ‘’; }
if ($w(” #mobilecheckbox “).value === ‘’) { $w(” #mobilecheckbox “).value = ‘Mobile’; } else { $w(” #mobilecheckbox “).value = ‘’; }
function valueCombine() {
let checkedValue = $w(” #pccheckbox “).value + " " + $w(” #ps4checkbox “).value + " " + $w(” #xboxcheckbox “).value + " " + $w(” #nintendoswitchcheckbox “).value + " " + $w(” #mobilecheckbox “).value;
$w(” #testValue ").value = checkedValue;}
}
export function registerbutton_mouseIn() {
valueCombine();
}

Here is my error message: Loading the code for the Registration popup. To debug this code, open f5sse.js in Developer Tools. There was an error in your script. The element selector function (usually $w) cannot be used before the page is ready

any help?? or ideas?

You can try taking the register button click function out of the onReady function and putting it back through the onClick in the properties panel.

Or you can keep it within the onReady function and try putting your code like this:

import wixUsers from 'wix-users';
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';

$w.onReady(function () {

    $w("#registerButton").onClick( (event) => {
    
    let email = $w("#email").value;
    //rest of code......

I am no good at coding, still learning. is there a way you can plug the code you provided into the code I provided so I can copy and paste it? it would be greatly appreciated.