jquery click on anchor element forces scroll to top?

后端 未结 8 1600
故里飘歌
故里飘歌 2020-12-28 08:07

jQuery hyperlinks - href value? text][1]

I am running in to a problem using jquery and a click event attached to an anchor element. [1]: jQuery hyperlinks - href

8条回答
  •  醉酒成梦
    2020-12-28 08:44

    It helped me a lot with the below code. Thank you!

            $(document).ready(function() {
            $(".dropdown dt a").click(function(event) {
            event.preventDefault();
                $(".dropdown dd ul").toggle('slow');
            });           
            $(".dropdown dd ul li a").click(function(event) {
            event.preventDefault();
                $(".dropdown dd ul").hide();
            });
        });
    

提交回复
热议问题