答案 0 :(得分:0)
您需要在无冲突模式下运行jQuery。有关详细信息,请参阅此kb文章:https://kb.sitecore.net/articles/286042
要在无冲突模式下运行jQuery,您可以像这样包装脚本:
(function ($) {
...
})(jQuery);
或像这样设置你的jquery:
<!-- Putting jQuery into no-conflict mode. -->
<script src="prototype.js"></script>
<script src="jquery.js"></script>
<script>
var $j = jQuery.noConflict();
// $j is now an alias to the jQuery function; creating the new alias is optional.
$j(document).ready(function() {
$j( "div" ).hide();
});
// The $ variable now has the prototype meaning, which is a shortcut for
// document.getElementById(). mainDiv below is a DOM element, not a jQuery object.
window.onload = function() {
var mainDiv = $( "main" );
}
</script>
信用:http://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/
这篇文章也回答了类似的问题:Sitecore 8 experience editor and jquery