开发者

Disable buttonset while keeping default style

开发者 https://www.devze.com 2023-01-28 11:05 出处:网络
Is there a way where I can disable a buttonset in jQuery UI but prevent the buttonsets style from changing to the \"grayed out\" look when setting the buttons to disabled?

Is there a way where I can disable a buttonset in jQuery UI but prevent the buttonsets style from changing to the "grayed out" look when setting the buttons to disabled?

I have tried simply handling the click event of the buttons. IE:

 $("#myRadioButton").click(function (event) { event.preventDefault(); });
 $("#myRadioButton1").click(function (event) { event.preventDefault(); });

But this doesnt seem to work.

I am guessing my best bet is to apply the style from the buttonset to non jQuery generated ones and setting them to disabled yeah? Only reason I am wanting开发者_开发百科 to avoid this as in future the ability to click the buttons will be enabled


The way I have approached this is to create two classes, 'disabled' and 'enabled', and assign them to the button/image as needed. In my click function, I do a check for the class and if there is a 'disabled' class, I return the user.

$('#myRadioButton').click(function(e) { if ($(this).attr('class') == 'disabled' return; });

0

精彩评论

暂无评论...
验证码 换一张
取 消