Day 58 前端学习笔记:jQuery 基础语法(上)
Part 0: 基本语法
$(xx).方法名()
Part 1: 基本选择器
id 选择器:$("#idName")
class 选择器:$(".className")
标签选择器:$("tagName")
所有元素选择器:$("*")
组合选择器:$("#idName,.className,tagName")
Part 2: 层级选择器
子子孙孙选择器: $("选择器1 空格 选择器2")
儿子选择器: $("选择器1 > 选择器2")
毗邻选择器: $("选择器1+选择器2")
弟弟选择器: $("选择器1~选择器2")
Part 3: 筛选器
:first
:last
:even
:odd
:eq(index)
:gt(index)
:lt(index)
Part 4: 属性选择器
$("a[href=' ']") --> 注意:双引号里面用单引号
Part 5: 表单选择器
:checkbox
:text
:password
Part 6: 导航器
往后找:.next() .nextAll() .nextUnitl()
往前找:.prev() .prevAll() .prevUntil()
往外层找:.parent() .parents() .parentsUntil()
查找方法:.find()
后代选择器: .children()
兄弟选择器: .siblings()
Part 7: not 和 has
not:
写在引号里面的: --> $("#my-checkbox input:not(:checked)")
写在外面当方法用的 --> $("#my-checkbox input").not(":checked")
has:
写在引号内表示有什么的 --> $("label:has('input')")
写在外面当方法用的: --> $("label").has("input")

浙公网安备 33010602011771号