javascript - django with basic Jquery not responding -
i have django project implemented jquery function toggle link not working. link not display hidden contect want display on toggle. code written below.
<a href="#" class="comment-reply-btn">rep</a> <div class="comment-reply" style="display: none;"> {% child_comment in comment.children%} {{ child_comment.timestamp|timesince } {% endfor %} </div> <script type="text/javascript"> $(document).ready(function(){ $(".comment-reply-btn").click(function(event){ event.preventdefault(); $(this).parent().next("comment-reply").fadetoggle(); }) }) </script>
you're navigating wrong dom element. next()
finds next matching sibling, you've put parent()
first - looking next sibling of parent. drop parent call.
$(this).next("comment-reply").fadetoggle();
Comments
Post a Comment