JQ常用选择器

JQ常用选择器

*:	//所有的元素   
	$("body *")	//选择body内所有元素  

#id	//选取带有唯一的指定id的元素

​	$("#hope")	//选取id="hope"的元素

.class	//选取带有指定的class元素(与id选择器不同,class选择器常用于多个元素)

​	$(".hope")	//选取class="hope"的元素

element	//选取带有指定标签名的元素

​	$("p")	//选取所有<p>标签	$("a")	//选取所有<a>标签

:first	//选择器选取的第一个元素

​	$("p:first")	//选择第一个<p>元素	$("a:first")	//选取第一个<a>元素

:last	//选择器选取的最后一个元素

​	$("p:last")	//选择最后一个<p>元素	$("a:last")	//选择最后一个<a>元素

:not()	//选择除指定元素以外的元素

​	$("p:not(.hope)")	//选择除了class="hope"元素以外的所有<p>元素

​	$("input:not(:empty)")	//所有不为空的input元素

:header	$(":header")	//所有标题元素<h1>-<h6>

:hidden	//选择所有隐藏的元素

​	$("p:hidden")	//选择所有隐藏的<p>元素

[]	$("[id]")	//选择所有带有id的元素

​	$("[id='hope']")	//选择所有id="hope"的元素

​	$("[id!='hope']")	//选择所有id!="hope"的元素

:input	$(":input")	//所有 <input> 元素

:text	$(":text")	//所有 type="text" 的 <input> 元素

:password	$(":password")	//所有 type="password" 的 <input> 元素

:radio	$(":radio")	//所有 type="radio" 的 <input> 元素

:checkbox	$(":checkbox")	//所有 type="checkbox" 的 <input> 元素

:submit	$(":submit")	//所有 type="submit" 的 <input> 元素

:reset	$(":reset")	//所有 type="reset" 的 <input> 元素

:button	$(":button")	//所有 type="button" 的 <input> 元素

:image	$(":image")	//所有 type="image" 的 <input> 元素

:file	$(":file")	//所有 type="file" 的 <input> 元素:selected	$(":selected")	所有被选取的 input 元素

:checked	$(":checked")	//所有被选中的 input 元素

:selected	$(":selected")	//所有被选取的 input 元素

:checked	$(":checked")	//所有被选中的 input 元素

整理可能不完整,欢迎大家补充。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值