@Yong: you’ll need to load a jQuery library and then call the code after the page has loaded. I could give you a step-by-step manual but I recommend you check out a tutorial at http://www.jquery.com, so you’d know what you’re doing.
@Paulie_D: see what you mean, but I’ve had situations where I really needed to select a parent element if the child element had some class or other condition. Can’t remember what it was exactly, but just saying that it does happen sometimes! ;)