views:

168

answers:

2

For example:

$("table tr").click( function(event)
{
   //Say, here i want get the data of td element where its class name="special"
});

Is there any way I can select a element while in the click event, a element under the attached element above ( $("table tr") )?

+2  A: 

Something like

$(this).find(".special").html();

I think that that works

stjohnroe
Thanks man! It worked! :)
Saneef
+4  A: 

In this specific case, you can do this:

$("table tr").click( function(event)
{
   $(this).children('td.special').whatEverYouNeed();
});

Generally speaking, you need to use find():

$("table tr").click( function(event)
{
   $(this).find('td.special').whatEverYouNeed();
});
DrJokepu
You can also use `$('td.special', this)` - that will limit the scope of the selector to the container `this`
Jimbo