Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I have a disabled button in a btn-group after a call to reset?

How can I have a disabled button in a btn-group after a call to reset?

I have a btn-group. I set one button as disabled. All works fine.

But, if I call button('reset') then it removed the disabled on the button and it can NEVER be added again.

Here is a fiddle http://jsfiddle.net/ejW3w/66/

$(".btn-group button").button("reset"); // removed the disable !!
$(".btn-group button").addClass('disabled').attr('disabled','disabled'); // This addclass does not re-add the disabled !!

I try add disabled with .addClass('disabled').attr('disabled','disabled') : but nothing works.

Thx..

like image 732
Warren Avatar asked Jan 23 '26 15:01

Warren


1 Answers

Try this:

$(".btn-group button").addClass('disabled').prop('disabled',true);

Fiddle http://jsfiddle.net/ejW3w/70/

Docs http://api.jquery.com/prop/

like image 107
Rohan Kumar Avatar answered Jan 25 '26 09:01

Rohan Kumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!