Jquery学习
创建JQuery对象的方法,
$(selectors, context), 其中selectors是Dom文档节点的选择路径, context是可选的,为jquery对象或者dom节点, 整 个函数的意思是在context中寻找符合selectors的节点,把这些节点组装成jquery对象。
$(html), 把html字符转化成dom对象。
$(elements), 把dom对象包裹成JQuery对象,这样就可以使用jQuery的方法了
$(callback), 应该相当与onLoad = callback吧.
jQuery选择符
基本选择符
#id, element, .class, *
层次选择符
ancestor descendant 在祖先中的后代中选择满足条件的,
parent > child 在子节点中选择
prev + next 在后退轴中选择节点
prev ~ siblings 在后退轴的兄弟节点中选择
基本过滤选择符
:first, :last, :not(selector), :even, :odd, :eq(index), :gt(index), :lt(index);
:header, :animated.
内容过滤选择符:
:empty, :has(selector), :parent
可视过滤符,
:hidden, :visible.
属性过滤符
[attribute] 有此属性, [checked]
[attribute=value]
[attribute!=value] 不等于
[attribute^=value] 以value开头
[attribute$=value] 以value结束
[attribute*=value]包含
[selector1][selector2]交集
子节点过滤
:nth-child, :first-child, :last-child, :only-child
form选择符
:input, :text, :password, :radio, :checkbox, :submit,
:image, :reset, :button, :file, :hidden
form过滤符
:enabled, :disabled, :checked, :selected.
属性:
attr(name), attr({name:value, }), attr(key, value), attr(key, fn), removeAttr(name)
类: addClass(class), hasClass(class), removeClass(class), toggleClass(class)
html(), html(value), text(), text(text), val(), val(value), value([])多值东西。
遍历jQuery对象。
过滤: eq(index), hasClass(class), filter(expr), filter(fn), is(expr), map(callback),
not(expr), slice(start, end)
查找, add(expr), 添加,
创建JQuery对象的方法,
$(selectors, context), 其中selectors是Dom文档节点的选择路径, context是可选的,为jquery对象或者dom节点, 整 个函数的意思是在context中寻找符合selectors的节点,把这些节点组装成jquery对象。
$(html), 把html字符转化成dom对象。
$(elements), 把dom对象包裹成JQuery对象,这样就可以使用jQuery的方法了
$(callback), 应该相当与onLoad = callback吧.
jQuery选择符
基本选择符
#id, element, .class, *
层次选择符
ancestor descendant 在祖先中的后代中选择满足条件的,
parent > child 在子节点中选择
prev + next 在后退轴中选择节点
prev ~ siblings 在后退轴的兄弟节点中选择
基本过滤选择符
:first, :last, :not(selector), :even, :odd, :eq(index), :gt(index), :lt(index);
:header, :animated.
内容过滤选择符:
:empty, :has(selector), :parent
可视过滤符,
:hidden, :visible.
属性过滤符
[attribute] 有此属性, [checked]
[attribute=value]
[attribute!=value] 不等于
[attribute^=value] 以value开头
[attribute$=value] 以value结束
[attribute*=value]包含
[selector1][selector2]交集
子节点过滤
:nth-child, :first-child, :last-child, :only-child
form选择符
:input, :text, :password, :radio, :checkbox, :submit,
:image, :reset, :button, :file, :hidden
form过滤符
:enabled, :disabled, :checked, :selected.
属性:
attr(name), attr({name:value, }), attr(key, value), attr(key, fn), removeAttr(name)
类: addClass(class), hasClass(class), removeClass(class), toggleClass(class)
html(), html(value), text(), text(text), val(), val(value), value([])多值东西。
遍历jQuery对象。
过滤: eq(index), hasClass(class), filter(expr), filter(fn), is(expr), map(callback),
not(expr), slice(start, end)
查找, add(expr), 添加,