jQuery jQuery常用選擇器

2021-08-29 18:22:25 字數 697 閱讀 5673

注意:jquery是乙個集合,所有很多時候返回值也是乙個集合

常用選擇器

$("*") 			所有元素

$("#id") id選擇器

$(".class") 類選擇器

$("tagname") 標籤選擇器

$("#id1,.class,tagname") 多條件選擇

$(":first") 乙個

$(":last") 最後乙個

$(":eq(index)") 下標為index

$(":not(selector)") 所有不滿足select篩選器的

$(":contains(text)") 包含指定字串的所有元素

$("[attribute=value]") 屬性等於屬性值的

$("parent > child") 選擇指定parent的直接子元素child

$(" ancestor child") 選擇指定ancestor的所有子孫元素child

$("prev ~ siblings") 選擇prev 所有的兄弟元素

$("prev + next") 直接跟在prev後面的next元素

$(this) 當前物件選擇器

.filter(selector) 此過濾器也可以起到選擇器作用

jQuery jQuery 效果 動畫

jquery animate 方法允許您建立自定義的動畫。jquery 動畫例項 jquery jquery animate 方法用於建立自定義動畫。語法 selector animate speed,callback 必需的 params 引數定義形成動畫的 css 屬性。可選的 speed 引數...

jquery jquery基礎知識

總體介紹 jquery是乙個js的類庫,為了減少 量實現更多的功能 2 分清dom物件和jquery物件。使用jquery庫自帶方法獲取頁面dom元素的物件叫jquery物件,儲存jquery物件的變數常用 開頭。jquery物件的方法dom物件無法使用,dom物件的方法jquery物件無法使用。3...

jQuery jQuery獲取視窗 頁面高度寬度

alert window height 瀏覽器時下視窗可視區域高度 alert document height 瀏覽器時下視窗文件的高度 alert document.body height 瀏覽器時下視窗文件body的高度 alert document.body outerheight true ...