Nice.
 
If you need to duplicate exactly the behavior of the .children('h3') in the
original code, add another > to the selector. Also you can leave out the
inner $() call:
 
$( '> h3 > a,  > a', this ).css('text-decoration', 'underline');
 
Alternatively, write it like this:
 
$(this).find('> h3 > a,  > a').css('text-decoration', 'underline');
 
I think that's a little easier to follow, and it's a tiny bit faster too.
When you use the $(selector,context) notation, jQuery converts it to
$(context).find(selector) for you. (See lines 75-78 of the uncompressed
jQuery.js 1.3.2.)
 
-Mike



  _____  

From: Mauricio (Maujor) Samy Silva


$( 'h3 > a,  > a', $(this) ).css('text-decoration', 'underline');
 
MaurĂ­cio

-----Mensagem Original----- 
De: Jacques Choquette -  <mailto:j...@whistlergraphicdesign.com>
WhistlerGraphicDesign.com 

$(this).children("h3").children("a").css("text-decoration",
"underline");$(this).children("a").css("text-decoration",
"underline");

I am changing the css text decoration on A tags within H3 elements and
also on child A tags is there not a way to bundle these together? so I
would only have to write out the .css("text-decoration", "underline");
part once?

Reply via email to