我使用带有$.load()功能的 jQuery 在我的主 html 文件中包含标记(来自单独的文件),index.html
例如,我加载contact.html:
<div id="bloc_load"></div> in 'index.html'
这工作正常。
问题是,在contact.html我有:
<input type="button" id="button_of_contact">
此元素已加载,index.html但我无法通过以下方式访问它:
$('#button_of_contact').click(function(){
alert('Click');
});
index.html如果我在加载后查看源代码contact.html,我会看到:
<div id="bloc_load"></div>
是空的div,所以我认为 jQuery 无法访问。我该如何解决这个问题?