jquery-ui button disable behavior is not right
-
04-10-2020 - |
Question
I disable my jqueryui button in its click event like this
$('#btn').button().click(function(){
$(this).button('disable');
});
and it seems that the button always stays in hover state when I enable it in another place later. I have tried to add $('#btn').button('refresh'), but it's not work. How can I restore its state to default when it's been enabled?
Solution
You can use .trigger('mouseout')
.
Demo here
OTHER TIPS
When you use the jQuery UI, usually you also use the embedded CSS. When you disable an element the library add the relative class. Maybe you can disable this behaviour when you declare the button.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow