First thing, I went through all possible other solutions provided plus googled this problem too but those are either using jquery etc. or other techniques that I can't use to solve my problem here so please don't mark this as duplicate.
Now, the problem I'm facing is that I have a submit button that disables through javascript if the user inputs are not valid.
I'm using disabled=true
and css property "pointer-events"
to disable all hover attributes too because I've colored animations for button.
The javascript function to check if the button should be disabled (shouldISubmit() js function) is through event "onMouseOver
".
Now the problem is, if once the button is disabled, it disables the onMouseOver
action and thus it doesn't call the shouldISubmit()
function again and thus is disabled forever.
Is there some other way I can do the disabling or use any other action-event to call the function etc. so I can solve this problem.
This is function shouldISubmit()
that disables or enables the button.
function shouldISubmit(){
if(FNF){
document.getElementById("regButton").disabled=false;
document.getElementById("regButton").style.pointerEvents='auto';
}
else{
document.getElementById("regButton").disabled=true;
document.getElementById("regButton").style.pointerEvents='none';
}
}
This is my button.
<div class="button container">
<br/>
<button class="buttons" name = "register" onMouseOver=shouldISubmit(); id="regButton">
Register
</button>
</div>