4

I am using a jquery selector

$('input,select,textarea').not('table input').attr('disabled',true);

here I am disabling all input, select, and textarea control. but I dont need to disable any control that is in a table. I have done it using .not('table input') but I also need to mention select along with input control in a table.

I have select conrol in table, whcih i dont want to disable. what would be the selector for this.

1
  • did you try .not('table input, table select') ? Commented Oct 19, 2010 at 6:16

3 Answers 3

2
$('input,select,textarea').not('table input').not('table select').attr('disabled',true);
Sign up to request clarification or add additional context in comments.

Comments

1
$('input,select,textarea').not('table input,table select').attr('disabled',true);

Comments

1

You could either use something like:

$('input,select,textarea').not('table input').not('table select').attr('disabled',true);

Or shorter:

$('input,select,textarea').not('table input,table select').attr('disabled',true);

But you could also add a class to all your inputs that are to be disabled and simply use:

$('.toBeDisabled').attr('disabled',true);

Or some not to be disabled:

$('input,select,textarea').not('.notToBeDisabled').attr('disabled',true);

Or if you want to include all form elements (also buttons), then use:

$(':input').not('table :input').attr('disabled',true);

Comments

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.