jQuery學習資料整理

2021-09-02 02:51:52 字數 890 閱讀 1694

第二章 選擇器

一.選擇器

1.基本選擇器

2.層次選擇器

$(".class div")

$("parent>child")

$(".class").nextal("div")

$("#one").next("div")

silbings("div")

3.過濾選擇器

篩選出dom元素

a.基本過濾

$("div:first")

$("div:last")

$("div:not(.class)")

$("div:even")

$("div:odd")

$("div:eq(1)")

$("div:gt(1)")

$("div:lt(1)")

b.內容過濾

$("div:contains(abc)")

$("div:empty")

$("div:has('.class')")

$("div:parent")

c.可見性過濾

$(" :hidden")

$(" :visible")

d.屬性過濾

通過元素的屬性獲取元素

$("div[id]")

$("div[id][title$='test']")

e.子元素過濾

$("div.one :nth-child(2n+1)")

f.表單物件屬性過濾

選擇的下拉框,多選框元素

$("#form1:enable")

$("input:checked")

$("select:selected")

4.表單選擇器

例子:

JQuery函式整理

1.文件載入完成執行函式 document ready function 2.新增 刪除css類 some id addclass newclassname some id removeclass classnametoberemoved 3.選擇符 利用了css和xpath xml path la...

jQuery知識整理

1.頁面重新整理方法 有時候可能會用到 window.location.reload 重新整理當前頁面.親測有效 parent.location.reload 重新整理父親物件 用於框架 opener.location.reload 重新整理父視窗物件 用於單開視窗 top.location.rel...

jQuery學習筆記(五)JQ複習整理

jq層級選擇器 1,find 找到索引的子代 2,children 找到一級子代 3,next 找到下乙個兄弟元素 4,nextall 找到下面所有的兄弟 5,prev 找到上乙個兄弟 6,prevall 找到上面所有的兄弟 7,nextuntil 找到下面的所有兄弟,知道乙個元素為止 8,prev...