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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -