You have a problem in your CODE! → You are using more than one → onReady()
!!! BAD IDEA !!!
Not sure, if this is the functionality you were looking for…
import wixUsers from 'wix-users';
import wixData from 'wix-data';
import wixLocation from 'wix-location';
$w.onReady(() => {
const currentUser = wixUsers.currentUser; console.log("Current-USER: ", currentUser);
$w("#checkbox1, #checkbox2").onChange((event)=> {
check_Function();
});
check_Function();
wixUsers.onLogin((user)=>{console.log("USER: ", user);
check_Function();
});
});
function check_Function() {
let isChecked1 = $w('#checkbox1').checked; console.log(isChecked1);
let isChecked2 = $w('#checkbox2').checked; console.log(isChecked2);
if(isChecked1 && isChecked2){console.log("Both Checkboxes are checked!");
$w("#button14").show();
}
else{
$w('#button14').hide();
console.log("Not both of checkboxes are checked!");
}
if (currentUser.loggedIn && currentUser.role === 'Member'){console.log("MEMBER");
$w("#button13").show();
}
if (currentUser.loggedIn && currentUser.role === 'Visitor'){console.log("VISITOR");
$w("#button13").hide();
}
}
When do you want to start your function ?