Jquery how to bind click event on dynamically created elements?

前端 未结 2 1320
难免孤独
难免孤独 2020-12-02 02:29

I tried the below code but it is not working



        
2条回答
  •  青春惊慌失措
    2020-12-02 02:43

    You forgot the DOM ready handler

    Encase your code inside the ready handler and should work fine unless you have any errors showing up in our console.

    $(function() {
        // Your code here
    });
    

提交回复
热议问题