how to trigger click event on dynamically created element in jquery

后端 未结 4 914
清酒与你
清酒与你 2021-01-12 02:18
if($(\'#term\').children().length == 0){
        $(\"#term\").append(\"
    \"); var i; for(i=1;
    4条回答
    •  独厮守ぢ
      2021-01-12 02:57

      use event delgation on inside your ready function

      try this

       $(function(){
         $('#term').on('click','li:first',function(){
          //do your stuff
         });
       });
      

    提交回复
    热议问题