jquery click event not firing?

前端 未结 4 2070
后悔当初
后悔当初 2020-12-08 02:49

I have this PAGE and I have if you scroll down the map to the li here is my code

HTML

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-08 03:12

    You need to prevent the default event (following the link), otherwise your link will load a new page:

        $(document).ready(function(){
            $('.play_navigation a').click(function(e){
                e.preventDefault();
                console.log("this is the click");
            });
        });
    

    As pointed out in comments, if your link has no href, then it's not a link, use something else.

    Not working? Your code is A MESS! and ready() events everywhere... clean it, put all your scripts in ONE ready event and then try again, it will very likely sort things out.

提交回复
热议问题