第一个片段无法正常工作.但是,当用jQuery替换所有$(美元符号)时它会开始工作(参见第二个片段).但我真的不明白为什么?任何人都可以向我解释这个吗?非常感谢!
第一个片段
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");
});
});
Run Code Online (Sandbox Code Playgroud)
第二个片段
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");
});
});
Run Code Online (Sandbox Code Playgroud) jquery ×1