相关疑难解决方法(0)

$和jQuery有什么区别

当我尝试使用$("#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

21
推荐指数
3
解决办法
1万
查看次数

标签 统计

jquery ×1