I have a button onClick in the HTML side. I'm using a javascript function to do some actions. I need to change the value of a boolean using the HTML button. I have been looking at the forum but so far I didn't find something. Somebody can guide me here?
Thanks.
code:
JS
var buttonClicked = false;
window.addEventListener('load',function(){
console.log(buttonClicked);
document.getElementById('BtnGotit').addEventListener('onclick',function(){
buttonClicked = true;
console.log(buttonClicked);
});
});
function desktopMove(e){
if(buttonClicked == true){
var wH = $(window).height();
var wW = $(window).width();
var x = e.clientX;
var y = e.clientY;
if(x <= 20){
//Left
$pageTrigger = $('.pt-page-current').find('.right');
if($pageTrigger.length)
Animate($pageTrigger);
}else if(x >= (wW - 50)){
//Right
$pageTrigger = $('.pt-page-current').find('.left');
if($pageTrigger.length)
Animate($pageTrigger);
}else if(y <= 50){
//Top
$pageTrigger = $('.pt-page-current').find('.back');
if($pageTrigger.length)
Animate($pageTrigger);
}else if(y >= (wH - 50)){
//Bottom
$pageTrigger = $('.pt-page-current').find('.next');
if($pageTrigger.length)
Animate($pageTrigger);
}
}
}
HTML
> <button2 onclick="function()" class = "BtnGotit" >Ok, GOT IT.</button2><br>