I have a problem. I want to catch div with class tooltip_content
per click <i class="tooltip"></i>
in code:
<label><span>Data</span><i class="tooltip"></i></label>
<div class="tooltip_conteiner">
<div class="tooltip_content">
<h3>asddd</h3>
</div>
</div>
With this jQuery code:
$(".tooltip").click(function(e) {
$(this).next("div .tooltip_content").toggle();
});
But this doesn't work. Any suggestions?
Almost there, try:
$(".tooltip").click(function(e){
$(this).closest('label').next("div").find('.tooltip_content').toggle();
});
You need closest to get to the parent label
and then to its sibling and then do a find.
if each of your label
and tooltip_conteiner
both are enclosed in a container then you could just do:
$(this).closest('container').find('.tooltip_content').toggle();