Combining $(this) with selector
Ok, I know that there are many times where you may be using a click function of an element but you need to use specifically that element you clicked siblings or children. Being able to stack the $(this) selector with other ones can be a little difficult or puzzling at times. Check below on a couple different ways of sticking them together.
Notice in the code that a comma “,” is used and not the concatenation plus “+”.
// find out if a selected element's is visible.
$visible = $(this,":visible").length; // returns true of false
// find out if a selected element's immediate sibling div is visible.
$visible = $(this).next('div:visible').length; // returns true of false
// hide the selected previous siblings element, <span>hide me</span><element>this</element>
$('+ span', this).hide();
// hide the selected element's child with the class name .class
$(this,".class").hide(); // returns true of false