Tuesday, 5 March 2013

Disabling controls within a CSS class

I am working on a task where I needed to disable all of controls within a class. I have tried several ways but only one worked for me which is,

$(".myCSSClassName:input").attr('disabled', true);

This will definitely work when you have a div with class named as "myCSSClassName:input" it will disable all controls within this specific class.

Other possible ways of disabling controls within a CSS class are mentioned below but they didn't worked for me,


$('input.myClass').attr('disabled', '');

$("input.myClass").prop("disabled", true);

$('input.myClass').attr('disabled', 'disabled');

There are few other options that seems promising can view on this link.

No comments:

Post a Comment