【发布时间】:2011-07-19 11:23:41
【问题描述】:
第一个 sn-p 不起作用。但是,当用 jQuery 替换所有 $(美元符号)时,它开始工作(参见 2nd sn-p)。但我真的不明白为什么?谁能给我解释一下?非常感谢!
第一个片段
jQuery.noConflict();
$(document).ready(function(){
$("#insideTable > tbody > tr:odd").addClass("odd");
$("#insideTable > tbody > tr:not(.odd)").hide();
$("#insideTable > tbody > tr:odd").show();
$("#insideTable > tbody > tr.odd").click(function(){
$(this).next().toggle();
$(this).find(".arrow").toggleClass("up");
});
});
第二个片段
jQuery.noConflict();
jQuery(document).ready(function(){
jQuery("#insideTable > tbody > tr:odd").addClass("odd");
jQuery("#insideTable > tbody > tr:not(.odd)").hide();
jQuery("#insideTable > tbody > tr:odd").show();
jQuery("#insideTable > tbody > tr.odd").click(function(){
jQuery(this).next().toggle();
jQuery(this).find(".arrow").toggleClass("up");
});
});
【问题讨论】:
标签: jquery