jQuery學習(監聽DOM載入)

2022-07-15 02:24:10 字數 1145 閱讀 8517

jquery的extend方法

functionnjquery() 

/*njquery.extend = function (obj)

this[key] = obj[key];

}}njquery.extend(

});njquery.istest();

*//*

njquery.prototype.extend = function (obj)

this[key] = obj[key];

}}var q = new njquery();

q.extend(

});q.isdemo();

*/njquery.extend = njquery.prototype.extend = function(obj)

}// njquery.extend({});

var q = newnjquery();

q.extend({});

jquery監聽dom載入

/*

onload事件會等到dom元素載入完畢, 並且還會等到資源也載入完畢才會執行

domcontentloaded事件只會等到dom元素載入完畢就會執行**

*//*

window.onload = function (ev)

document.addeventlistener("domcontentloaded", function () );

*//*

document.readystate屬性有如下的狀態

uninitialized - 還未開始載入

loading - 載入中

interactive - 已載入,文件與使用者可以開始互動

complete - 載入完成

onreadystatechange事件就是專門用於監聽document.readystate屬性的改變的

*//*

document.attachevent("onreadystatechange", function ()

});*/

$(function

() );

jQuery中的dom載入

jquery中的載入 function 呼叫的是rootjquery.ready selector 其中rootjquery jquery document 所以上述 可以寫成 document ready function ready 中的ready 是例項方法 ready function fn...

jQuery學習筆記 DOM操作

1.1 dom物件轉jquery物件 用 把dom物件包起來即可 var domobj document.getelementbyid demo var jqueryobj domobj 1.2 jquery物件轉dom物件 2種方法 index 和get index var jqueryobj d...

Jquery學習筆記 DOM操作

prepend 向每個匹配的元素內部前置內容 prependto after 向每個匹配的元素之後插入內容 insterafter before 在每個匹配的元素之前插入內容 insertbefore 1.remove 該節點所包含的所有後代節點將同時被刪除 返回值是乙個指向已被刪除的節點的引用,因...