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
$(".class",this).hide(); // returns true or false
UPDATE!! A plugin is now available for this tutorial that includes more features read more...
When running a site with a boat load of javascript, you may want to run a script read more...
Download Plugin THEMES: theme-lighttheme-dark<link href="{{ path to js read more...
Greetings All! Since everyone was digging the Star Comment Rating I decided that read more...
How often do you work with tables? I work with them quite a bit and styling t read more...