I am new so please forgive me if I sound stupid.
So I am trying to make it so on mouse out the button disables. Here is what I tried so far: (Thanks in advance!)
function alertonclick() {
alert("You got me! GG. At least I tried.");
}
function addEvent(obj, evt, fn) {
if (obj.addEventListener) {
obj.addEventListener(evt, fn, false);
}
else if (obj.attachEvent) {
obj.attachEvent("on" + evt, fn);
}
}
addEvent(document, "mouseout", function(e) {
e = e ? e : window.event;
var from = e.relatedTarget || e.toElement;
if (!from || from.nodeName == "HTML") {
document.getElementById("button").disabled = true;
document.getElementById("button").value = "BUTTON IS DISABLED";
document.getElementById("button").style.background='808080';
}
});
HTML
<button id="button" tabindex="-1" onclick="alertonclick()" class="Rainbow buttonmove notouch button1 btn">Button</button>