4

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?

2 Answers 2

2

You can use .trigger('mouseout').

Demo here

Sign up to request clarification or add additional context in comments.

3 Comments

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

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.

Try http://jqueryui.com/demos/button/

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.