PhpStorm jQuery.noConflict()css完成无法正常工作

时间:2017-06-10 04:06:31

标签: jquery css phpstorm code-completion code-hinting



$('#') // 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>
&#13;
&#13;
&#13;

在评论中使用上下文

2 个答案:

答案 0 :(得分: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>

答案 1 :(得分:1)

我认为答案是模板/自动展开,就像我有一个模板$(&#39; jj的名字,所以jj + tab会给我我想要的东西......不是我打字慢,我只是喜欢黑客和我学习成为一个懒惰的程序员