I have some buttons, and in javascript I do some manipulation. Depending on what the user clicks, buttons will be enabled and disabled.
The logic and the enabling/disabling works well. But my css isn't updating the look of a disabled button. I think my question is, should it automatically update? Or do I need to handle that somehow?
I'm using ASP.NET MVC if that is relevant.
I simply added this to the top of my view (for testing) :
<style>
button[disabled] {
background: green;
}
</style>
and a snippet of the javascript :
function changeNameEnabled(enabled) {
document.getElementsByName("FullNameExact")[0].disabled = !enabled;
}
a sample button:
<button onclick="nameClick(this)" name="FullNameExact" style="height:20%;width:75%;top:5%;left:13%;margin-bottom:5%">FULL NAME EXACT</button>
and I can see in the browser that the button gains the disabled
attribute, and is unclickable