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") )?
From stackoverflow
-
Something like
$(this).find(".special").html();I think that that works
Saneef : Thanks man! It worked! :) -
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(); });Jimbo : You can also use `$('td.special', this)` - that will limit the scope of the selector to the container `this`
0 comments:
Post a Comment