当我尝试使用$("#div_id")在$(document).ready它返回NULL,但是当我使用jQuery("#div_id")它返回实际的对象!
为什么会这样?
更新:我尝试了noConflict方法而没有获得任何提示.
jQuery.noConflict()
function (a,b){return new c.fn.init(a,b)}
$.noConflict();
TypeError: Object function ()
{
return document.getElementById.apply(document, arguments)
} has no method 'noConflict'
Run Code Online (Sandbox Code Playgroud)
更新2:
$(document).ready(function() {
debugger;
});
<input type="text" id="test" name="test" value="123" />
Run Code Online (Sandbox Code Playgroud)
当我在控制台中运行以下代码时,我得到了这些结果:
$("#test").val()
TypeError: Cannot call method 'val' of null
jQuery("#test").val()
"123"
Run Code Online (Sandbox Code Playgroud)
谢谢
jquery ×1