code not working (3)

I made this registration lightbox but it’s not working. What did I do wrong?

import wixWindow from 'wix-window';
import wixUsers from 'wix-users';
import {fetch} from 'wix-fetch';
import wixData from 'wix-data';

    $w("#firstName").inputType = "text";
    $w("#lastName").inputType = "text";
    $w("#username").inputType = "text";
    $w("#email").inputType = "email";
    $w("#confirmEmail").inputType = "email";
    $w("#password").inputType = "password";
    $w("#confirmPassword").inputType = "password";

export function loginRedirect_click(event) {
    wixWindow.lightbox.close('Sign up');
    wixWindow.openLightbox('login');
}

export function closeWindow_click(event) {
    wixWindow.lightbox.close('Sign up');
}

let ipAddress;
let ipCountry;

$w.onReady(function (){

    getUserIP();

});

function getUserIP(){
    fetch('https://extreme-ip-lookup.com/json', {
        method: 'get'
    }).then((httpResponse) => {
        if(httpResponse.ok){
            return httpResponse.json();
        }
    }).then((json) => {
        ipAddress = json.query;
        ipCountry = json.country;
    });
}

export function register_click(event) {

    $w("#message").text = "Please wait..."; $w("#message").show();

        let value = $w("#message").text;
        $w("#message").html = "<p style='font-size: 14px; font-style: helvetica; text-align: right; color: #000000;'>" + value + "</p>";

    $w("#register").disable();

    let emails = [];
    emails.push()

    wixUsers.register($w("#email").value, $w("#password").value,
    {
        "contactInfo": {
            "firstName": $w("#firstName").value ,
            "lastName": $w("#lastName").value ,
            "emails": emails
        }
    }).then(() => {

        let rand = Math.random() .toString(36) .substr(2,3);
        let hours = Math.round(Date.now() / 1000 / 60 / 60) 
        let generatedId = rand.toString() + hours.toString();
        console.log (generatedId);

        let toInsert = {
            "_id": wixUsers.currentUser.id,arguments,
            "email": $w("#email").value,
            "peopleId": "x",
            "firstName": $w("#firstName").value,
            "lastName": $w("#lastName").value,
            "username": $w("#username").value,
            "phoneNumber": $w("#phoneNumber").value,
            "password": $w("#password").value,
            "organization": $w("#organizationCheckbox").checked,
            "emailVerify": "x" ,
            "country": ipCountry,
            "ipAddress": ipAddress,
            "profilePicture": 'https://static.wixstatic.com/media/feefcb_fbf50c3aad234b21a9b07c783f5a59b8~mv2.jpg'

        }

        wixData.insert("Members", toInsert)
        .then(() => {

                $w("#message").text = "Your account has been created!"; $w("#message").show();

                    let value = $w("#message").text;
                    $w("#message").html = "<p style='font-size: 14px; font-style: helvetica; text-align: right; color: #B1D3BB;'>" + value + "</p>";

        setTimeout(loginRedirect_click, 2000);

        }).catch((err) => {

                $w("#message").text = "An error occured. Please try again later."; $w("#message").show();

                let value = $w("#message").text;
                $w("#message").html = "<p style='font-size: 14px; font-style: helvetica; text-align: right; color: #FF4040;'>" + value + "</p>";

        })

    })
}

function doChecks(){

    wixData.query("People")
    .eq("username", $w("#username").value)
    .limit(1)
    .find()
    .then((results) => {

        if(results.items.length > 0) {

    $w("#message").text = "There is already a member with this username. Please enter a different username."; $w("#message").show();

        let value = $w("#message").text;
        $w("#message").html = "<p style='font-size: 14px; font-style: helvetica; text-align: right; color: #FF4040;'>" + value + "</p>";
        
        $w("#register").disable();

        } else if($w("#username").value.length < 2 || $w("#username").value.length > 20){

    $w("#message").text = "Username can't be less than 2 characters or more than 20 characters."; $w("#message").show();

        let value = $w("#message").text;
        $w("#message").html = "<p style='font-size: 14px; font-style: helvetica; text-align: right; color: #FF4040;'>" + value + "</p>";
        
        $w("#register").disable();

                } else if($w("#firstName").value.length > 50){

    $w("#message").text = "First name can't more than 50 characters."; $w("#message").show();

        let value = $w("#message").text;
        $w("#message").html = "<p style='font-size: 14px; font-style: helvetica; text-align: right; color: #FF4040;'>" + value + "</p>";
        
        $w("#register").disable();

                        } else if($w("#lastName").value.length > 50){

        $w("#message").text = "Last name can't more than 50 characters."; $w("#message").show();

        let value = $w("#message").text;
        $w("#message").html = "<p style='font-size: 14px; font-style: helvetica; text-align: right; color: #FF4040;'>" + value + "</p>";

                        } else if($w("#email").value.length > 50){

        $w("#message").text = "Email can't more than 50 characters."; $w("#message").show();

        let value = $w("#message").text;
        $w("#message").html = "<p style='font-size: 14px; font-style: helvetica; text-align: right; color: #FF4040;'>" + value + "</p>";

                        } else if($w("#email").value !== $w("#confirmEmail").value){

        $w("#message").text = "Email and confirm email don't match."; $w("#message").show();

        let value = $w("#message").text;
        $w("#message").html = "<p style='font-size: 14px; font-style: helvetica; text-align: right; color: #FF4040;'>" + value + "</p>";
        
        $w("#register").disable();

                        } else if($w("#password").value !== $w("#confirmPassword").value){

        $w("#message").text = "Password and confirm password don't match."; $w("#message").show();

        let value = $w("#message").text;
        $w("#message").html = "<p style='font-size: 14px; font-style: helvetica; text-align: right; color: #FF4040;'>" + value + "</p>";

                        } else if($w("#password").value.length < 2 || $w("#password").value.length > 20){

        $w("#message").text = "Password can't be less than 2 characters or more than 20 characters."; $w("#message").show();

        let value = $w("#message").text;
        $w("#message").html = "<p style='font-size: 14px; font-style: helvetica; text-align: right; color: #FF4040;'>" + value + "</p>";
        
        $w("#register").disable();

        } else {

            $w("#register").enable();
            $w("#message").hide();
        }

    })

}

export function firstName_keyPress(event) {
    clearTimeout(doChecks); setTimeout(doChecks, 2000)

}

export function lastName_keyPress(event) {
    clearTimeout(doChecks); setTimeout(doChecks, 2000)
    
}

export function username_keyPress(event) {
    clearTimeout(doChecks); setTimeout(doChecks, 2000)

    
}

export function email_keyPress(event) {    
    clearTimeout(doChecks); setTimeout(doChecks, 2000)

    
}

export function confirmEmail_keyPress(event) {
    clearTimeout(doChecks); setTimeout(doChecks, 2000)  

}

export function password_keyPress(event) {
    clearTimeout(doChecks); setTimeout(doChecks, 2000)    

}

export function confirmpassword_keyPress(event) {
    clearTimeout(doChecks); setTimeout(doChecks, 2000)    

}

export function phoneNumber_keyPress(event) {
    clearTimeout(doChecks); setTimeout(doChecks, 2000)

}

export function organizationCheckbox_change(event) {
    
    if($w("#organizationCheckbox").checked === true){
        $w("#username").placeholder = "Organization Name"
    } else {
        $w("#username").placeholder = "Username"
    }

}

export function seePassword_click(event) {
    $w("#password").inputType = "text";
    $w("#seePassword").hide();
    $w("#hidePassword").show();
}

export function hidePassword_click(event) {
    $w("#password").inputType = "password";
    $w("#hidePassword").hide();
    $w("#seePassword").show();
}

export function seePassword2_click(event) {
    $w("#confirmPassword").inputType = "text";
    $w("#seePassword2").hide();
    $w("#hidePassword2").show();
}

export function hidePassword2_click(event) {
    $w("#confirmPassword").inputType = "password";
    $w("#hidePassword2").hide();
    $w("#seePassword2").show();
}

help me with this please

Any operation with $w(selector) is always must be inside $w.onReady(function () { }) method

I added that and its still not working.

@eggwebtut
Just to say → it’s not working won’t help anybody.

-What exactly is still not working?
-Which errors do you get in the CONSOLE?

Try to use more → CONSOLE ← it is your BEST FRIEND (believe me)!

@russian-dima I used the console and it said I had some errors, but then I check and those errors aren’t really in the code.

@eggwebtut Where are those error-logs?
Where to find them ? You don’t want to provide some screenshots of your error-logs?