For example, if I were to use this code:
$(".Class").children(:last).click(function(){
$(this).siblings(":not(:last)").toggle();
}
Would “this” refer to the “.Class” class, or would it refer to the last child of the specified “.Class” class?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
thiswould refer to the DOM element that results matched in the final selector in the chain that triggers the event; in this case, the:lastchild of.Class. So, the event would trigger if you click thelastchild of the last.Classclass. See in this fiddle how onlyfoo2triggers the alert.Except, it won’t work as you’ve posted it, since
:lastshould be in quotes as a string.