I want to check if a div class element has been clicked.Is there a way in Javascript. I have a conditional statement which checked whether a style has certain attributes, but there is no way I know of checking whether a div class in that conditional statement has been clicked…
Here’s my code so far:
let a = document.getElementsByClassName("roll")[0];
let b = document.getElementsByClassName("effect")[0];
a.onclick = function(){
b.setAttribute('style','border-right:4px solid #aa2e27')
}
a.onmouseover = function(){
if(b.hasAttribute('style','border-right:none') && a.onclick.value == "false"){
b.setAttribute('style','border-right:4px solid #aa2e27');
}
}
As you can see, the if condition takes place on mouseover event. Is there a way to check this? (what I entered on mouseover doesnt trigger)