Parent is the DOM node which contains the targeted element. So in your example td would be the parent of input. Label would be a sibling of input, or you could use the prev('label') method if you wanted to target the label element.
-----Original Message----- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of TimW66 Sent: Thursday, June 11, 2009 12:11 PM To: jQuery (English) Subject: [jQuery] Question on filter() Hi all, I have the following JS code: $('table.tableView :inp...@readonly]').parent().filter(function() { return !$('label', this).length; }).addClass('readonly'); ------ And the following HTML code: <table class="tableView"> <thead> <tr> <th>test</th> </tr> </thead> <tbody> <tr> <td> <label for="foo">Foo</label> <input id="foo" type="text" value="foo" readonly="readonly"/> </td> </tr> <tr> <td> <input id="bar" type="text" value="bar" readonly="readonly"/> </td> </tr> <tr> <td> <label for="zed">Foo <input id="zed" type="text" value="zed" readonly="readonly"/> </label> </td> </tr> </tbody> </table> ------ What I expected is the first and third input box to not get the readonly class. However, the third input box does get the readonly class. Isn't "<label>" a parent of "<input>"? I should also mention I'm using jQuery v1.2.6.