多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# jQuery 参考手册 - 选择器 ## jQuery 选择器 | 选择器 | 实例 | 选取 | | --- | --- | --- | | [*](/jquery/selector_all.asp "jQuery * 选择器") | $("*") | 所有元素 | | [#_id_](/jquery/selector_id.asp "jQuery # 选择器") | $("#lastname") | id="lastname" 的元素 | | [._class_](/jquery/selector_class.asp "jQuery . 选择器") | $(".intro") | 所有 class="intro" 的元素 | | [_element_](/jquery/selector_element.asp "jQuery element 选择器") | $("p") | 所有 <p> 元素 | | ._class_._class_ | $(".intro.demo") | 所有 class="intro" 且 class="demo" 的元素 | | [:first](/jquery/selector_first.asp "jQuery :first 选择器") | $("p:first") | 第一个 <p> 元素 | | [:last](/jquery/selector_last.asp "jQuery :last 选择器") | $("p:last") | 最后一个 <p> 元素 | | [:even](/jquery/selector_even.asp "jQuery :even 选择器") | $("tr:even") | 所有偶数 <tr> 元素 | | [:odd](/jquery/selector_odd.asp "jQuery :odd 选择器") | $("tr:odd") | 所有奇数 <tr> 元素 | | [:eq(_index_)](/jquery/selector_eq.asp "jQuery :eq() 选择器") | $("ul li:eq(3)") | 列表中的第四个元素(index 从 0 开始) | | [:gt(_no_)](/jquery/selector_gt.asp "jQuery :gt 选择器") | $("ul li:gt(3)") | 列出 index 大于 3 的元素 | | [:lt(_no_)](/jquery/selector_lt.asp "jQuery :lt 选择器") | $("ul li:lt(3)") | 列出 index 小于 3 的元素 | | :not(_selector_) | $("input:not(:empty)") | 所有不为空的 input 元素 | | [:header](/jquery/selector_header.asp "jQuery :header 选择器") | $(":header") | 所有标题元素 <h1> - <h6> | | [:animated](/jquery/selector_animated.asp "jQuery :animated 选择器") | | 所有动画元素 | | [:contains(_text_)](/jquery/selector_contains.asp "jQuery :contains 选择器") | $(":contains('W3School')") | 包含指定字符串的所有元素 | | [:empty](/jquery/selector_empty.asp "jQuery :empty 选择器") | $(":empty") | 无子(元素)节点的所有元素 | | :hidden | $("p:hidden") | 所有隐藏的 <p> 元素 | | [:visible](/jquery/selector_visible.asp "jQuery :visible 选择器") | $("table:visible") | 所有可见的表格 | | s1,s2,s3 | $("th,td,.intro") | 所有带有匹配选择的元素 | | [[_attribute_]](/jquery/selector_attribute.asp "jQuery [attribute] 选择器") | $("[href]") | 所有带有 href 属性的元素 | | [[_attribute_=_value_]](/jquery/selector_attribute_equal_value.asp "jQuery [attribute=value] 选择器") | $("[href='#']") | 所有 href 属性的值等于 "#" 的元素 | | [[_attribute_!=_value_]](/jquery/selector_attribute_notequal_value.asp "jQuery [attribute!=value] 选择器") | $("[href!='#']") | 所有 href 属性的值不等于 "#" 的元素 | | [[_attribute_$=_value_]](/jquery/selector_attribute_end_value.asp "jQuery [attribute$=value] 选择器") | $("[href$='.jpg']") | 所有 href 属性的值包含以 ".jpg" 结尾的元素 | | [:input](/jquery/selector_input.asp "jQuery :input 选择器") | $(":input") | 所有 <input> 元素 | | [:text](/jquery/selector_input_text.asp "jQuery :text 选择器") | $(":text") | 所有 type="text" 的 <input> 元素 | | [:password](/jquery/selector_input_password.asp "jQuery :password 选择器") | $(":password") | 所有 type="password" 的 <input> 元素 | | [:radio](/jquery/selector_input_radio.asp "jQuery :radio 选择器") | $(":radio") | 所有 type="radio" 的 <input> 元素 | | [:checkbox](/jquery/selector_input_checkbox.asp "jQuery :checkbox 选择器") | $(":checkbox") | 所有 type="checkbox" 的 <input> 元素 | | [:submit](/jquery/selector_input_submit.asp "jQuery :submit 选择器") | $(":submit") | 所有 type="submit" 的 <input> 元素 | | [:reset](/jquery/selector_input_reset.asp "jQuery :reset 选择器") | $(":reset") | 所有 type="reset" 的 <input> 元素 | | [:button](/jquery/selector_input_button.asp "jQuery :button 选择器") | $(":button") | 所有 type="button" 的 <input> 元素 | | [:image](/jquery/selector_input_image.asp "jQuery :image 选择器") | $(":image") | 所有 type="image" 的 <input> 元素 | | [:file](/jquery/selector_input_file.asp "jQuery :file 选择器") | $(":file") | 所有 type="file" 的 <input> 元素 | | [:enabled](/jquery/selector_input_enabled.asp "jQuery :enabled 选择器") | $(":enabled") | 所有激活的 input 元素 | | [:disabled](/jquery/selector_input_disabled.asp "jQuery :disabled 选择器") | $(":disabled") | 所有禁用的 input 元素 | | [:selected](/jquery/selector_input_selected.asp "jQuery :selected 选择器") | $(":selected") | 所有被选取的 input 元素 | | [:checked](/jquery/selector_input_checked.asp "jQuery :checked 选择器") | $(":checked") | 所有被选中的 input 元素 | ## 参阅 教程:[jQuery 元素选择器语法](/jquery/jquery_selectors.asp "jQuery 选择器")