You might try just
var y = x.parent('div');
Would there ever be another div that could be a parent of one of these TD
tags?
-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of elubin
Sent: Tuesday, May 19, 2009 12:47 PM
To: jQuery
A div will never be a parent of a td. It will be an ancestor but not a
direct parent. .parents()
http://docs.jquery.com/Traversing/parents#exprwill look for
ancestors.
In other news, please use classes on your divs instead of pattern matching
the id. It's better for a variety of reasons.
aquaone
parents() worked, thank you. also the new closest() worked. what's
the exact difference between those two?
why classes instead of ids? div class=A is better than div
id=A? why? performance of jquery selectors?
On May 19, 1:53 pm, aquaone aqua...@gmail.com wrote:
A div will never be a
IDs have better performance, but classes applied to multiple elements
allow you to simplify logic and code.
div class=section id=sectionA
tabletrtd id=row_1eric 1/td/tr/table
/div
div class=section id=sectionB
tabletrtd id=row_2eric 2/td/tr/table
/div
var
x =
4 matches
Mail list logo