为什么$()不起作用,但是jQuery()起作用? [英] Why $() doesn't work but jQuery() works?
问题描述
我遇到一个问题,其中$("#register") returns null
,但是jQuery("#register")
正确返回对象.
I have an issue where $("#register") returns null
, but jQuery("#register")
returns object correctly.
这可能值一千个字:
您可以在Watch表达式中看到所有内容均按预期工作(jQuery === $ returns true
)
但是在控制台中却没有.而且在代码中它也不起作用,因为$("#register").validate
字符串不起作用.
As you can see in Watch expression everything works as expected (jQuery === $ returns true
)
But in console it doesn't. And in code it also doesn't, because the $("#register").validate
string doesn't work.
也许它必须对 $ script.js 做些事情?
Maybe it has to do something with $script.js thing?
推荐答案
很抱歉在5分钟后返回并说该代码有效.嗯.
I'm sorry to return in 5 minutes and say that the code works. Uh.
只是$是Web检查员会覆盖的东西.
It's just that $ is something the web inspector overrides.
$ script.js不会引起冲突.
The $script.js doesn't cause conflicts.
> jQuery.noConflict()
function (a,b){return new d.fn.init(a,b,g)}
> $
function ()
{
return document.getElementById.apply(document, arguments)
}
这是Chrome检查器问题:)
It's the chrome inspector problem :)
这篇关于为什么$()不起作用,但是jQuery()起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!