javascript - next("some class") doesn't work -
html
<div class="linksrtitle">lorem ipsum</div> <div class="linksrspace"></div> <div class="linksrwrap"> // div should slided <a class="linkr" href="volim-da-stoje.php">lorem ipsum</a> <a class="linkr" href="ova-salate-je-umrla.php">lorem ipsum</a> <a class="linkr" href="nova-rasa.php">lorem ipsum</a> </div> <div class="linksrspace"></div>
js
$(".linksrtitle").click(function(){ $(this).next(".linksrwrap").slidetoggle(); // doesn't work });
why click event doesn't work. console empty.
use nextall()
(with first()
, if multiple sibling same class there) that. next()
select immediate following sibling.
$(".linksrtitle").click(function() { $(this).nextall(".linksrwrap").slidetoggle(); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="linksrtitle">lorem ipsum</div> <div class="linksrspace"></div> <div class="linksrwrap">// div should slided <a class="linkr" href="volim-da-stoje.php">lorem ipsum</a> <a class="linkr" href="ova-salate-je-umrla.php">lorem ipsum</a> <a class="linkr" href="nova-rasa.php">lorem ipsum</a> </div> <div class="linksrspace"></div>
Comments
Post a Comment