views:

35

answers:

2

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?

A: 

When you use the JQuey UI, usually you also use the embedded CSS. When you disable an element the library add the relaive class. Maybe you can disable this behaviour when you declare the button. Try http://jqueryui.com/demos/button/

s.susini
I tried to destroy the button with $('#btn').button('destroy'), according to the documentation, it will return the button element back to pre-init state which means removing all the embedded CSS applied to the button element. After that, I recreate the button, but it still not work what I expected.
Cliffwolf
A: 

You can use .trigger('mouseout').

Demo here

sje397
It works as what I expected in your demo, but it is not when jquery ui theme applied in my case.
Cliffwolf
@Cliffwolf: A JQuery theme is applied in the demo. Check the 'manage resources' part of the config accordion on the left.
sje397
@sje397: I check out your demo in the FF and Google Chrome, yes, it works well, but the problem is still there under the IE8.
Cliffwolf
Can't help you there, sorry.
sje397
Thanks all the same
Cliffwolf