Show DevBest Bootstrap 'disabled' element fix

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
Bootstrap has a really nice feature where you can add a CSS class disabled to an element and it will 'fade' the colours of the element to make it looks as if the element is disabled, however, when you click on the specific element, any actions attached to it will still be working, so I wrote this simple piece of code that will fix that issue.

PHP:
$(".disabled").each(function(q,h){
    $(h).attr("disabled", "disabled");
});

Place this in your JavaScript file and you must ensure that you have the jQuery library included in your page.

This will now make any 'disabled' elements unusable.

Hope it helps,
Mark.
 

iDevon

Solo Dolo
Dec 27, 2010
404
49
Nice fix or shall I say "addition." Although, you can just simply remove href="#" and carry on with your day.
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
Nice fix or shall I say "addition." Although, you can just simply remove href="#" and carry on with your day.

Not necessarily, what about elements such as text boxes and buttons, etc?

- not a problem.
 

Users who are viewing this thread

Top