javascript events not working with dynamic content added with json

后端 未结 3 1397
别跟我提以往
别跟我提以往 2021-01-20 19:25

I\'m stuck with a situation where my DOM elements are generated dynamically based on $.getJSON and Javascript functions for this elements are not working. I\'ll

3条回答
  •  无人及你
    2021-01-20 20:14

    the easiest way is to add this after you add/generate your DOM

    $('script[src="site.js"]').remove();
    $('head').append('');
    

    of course your js function that generates DOM needs to be on another file than your site.js

提交回复
热议问题