[英]jQuery - Library use in id selector in generated content
In standard generated content, we use function like this: 在标准生成的内容中,我们使用如下函数:
$(document).on('click', "date_picker", function(){
alert("hello");
});
But how do we use in a function in generated content, for example the datepicker library from jQuery UI? 但是我们如何在函数中使用生成的内容,例如jQuery UI中的datepicker库?
Example of what i am trying to say 我想说的例子
$(document).on('click', 'date_picker').datepicker();
Once your dynamic content has been loaded, call the plugin like you normally would, ex: 加载动态内容后,请像往常一样调用该插件,例如:
$("#myDiv").load(somePath, function(data) {
$("#myLoadedContentID").datepicker();
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.