Recursively disabling all children of an element

Given a jQuery object that represents
a set of DOM elements, the .children()
method allows us to search through the
immediate children of these elements
in the DOM tree and construct a new
jQuery object from the matching
elements. The .find() and .children()
methods are similar, except that the
latter only travels a single level
down the DOM tree. Note also that like
most jQuery methods, .children() does
not return text nodes; to get all
children including text and comment
nodes, use .contents().

.children()

You can do this if you want to act on all descendants at any level of nesting:

$('#id_of_an_element').find('*').attr('disabled', true);

or using the descendant selector:

$('#id_of_an_element *').attr('disabled', true);

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)