tags:

views:

84

answers:

2

I want to be able to select all disabled decandants of a given element, in my particular instance a table cell and then enable them.

NOTE that there may be elements that are not "inputs"

I have tired the following with no success

$("#myCell [disabled='disabled']").removeAttr('disabled')

and

$("#myCell [disabled='disabled']").attr('disabled','')
+3  A: 

Try:

$('#myCell :input:disabled').removeAttr('disabled');

The :input selector is going to select all input elements, and the :disabled selector is going to select elements that are disabled. You could probably just have the :disabled selector but it doesn't hurt to have both and is probably marginally faster to do so.

Paolo Bergantino
This one won't work for me as I have other elements that are not input elements, selects for one, labels and thanks to the wonders of ASP.net tables and spans too
Jon P
...? I'm not sure how that is a problem knowing what the two selectors do?
Paolo Bergantino
A: 

My solution:

$("#myCell *[disabled='disabled']").removeAttr("disabled");

This * selector means 'all elements'

Gart