jQuery if element is next and has class? -
im using toggle visibility of element:
$(".trigger").click(function() { $(this).next().slidetoggle(); });
<p class="triggger">trigger</p> <p class="target">this target</p>
its working fun want make next element toggled if has class of target. following isnt working:
$(this).next().hasclass("target").slidetoggle();
this trick:
$(this).next(".target").slidetoggle();
.slidetoggle()
fired on next element if has classname of target
only.
Comments
Post a Comment