我只是写一个简单的插件供我自己在网页中使用。我有HTML标记,如:jQuery插件不运行
<ul id="ulview">
<li>...</li>
<li>...</li>
...
</ul>
和jQuery插件代码:
(function($) {
$.fn.ulView = function(){
//console.log(this);
this.children('li').each(function(){
alert('test');
});
}
})(jQuery);
和我申请的插件是这样的:
jQuery(document).ready(function($) {
$('#ulview').ulView();
}
出于某种原因警报( '测试')从未运行。但我可以看到jQuery对象已经在控制台中记录。我在这里错过了什么,感谢您的任何意见。
我说:‘但我可以看到jqury对象已被记录在控制台中。’ ...这意味着一切运行..除了... – bingjie2680
@ bingjie2680:它不能没有(jQuery)之前工作; .... – genesis
对不起,我有(jQuery)的地方。我忘了把它放在这里 – bingjie2680