1

$('#') // hint a list of id
var j = jQuery.noConflict()
j('#') // no hint
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

在评论中使用上下文

4

2 回答 2

1

我认为答案是模板/自动扩展,就像我有一个模板 $(' jj 的名称,所以 jj + tab 会给我我想要的......不是我打字慢,我只是更喜欢黑客和我学习做一个懒惰的程序员

于 2017-06-10T14:31:42.933 回答
1

<!-- 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>

于 2017-06-10T04:12:07.607 回答