JQuery选择器之自定义选择器

语法描述
B:animated匹配B的所有的动画元素
B:button匹配B的所有button元素(button, input[type=submit], input[type=reset] or input[type=button])
B:checkbox匹配B的所有checkbox元素( input[type=checkbox])
B:enabled匹配B的所有可用状态元素
B:file匹配B的所有类型为input[type=file]元素
B:header匹配B的所有<h1>-<h6>类型元素
B:hidden匹配B的所有隐藏元素
B:image匹配B的所有类型为input[type=image]元素
B:input匹配B的所有输入类型元素,包括:<input>, <select>, <textarea> and <button>
B:not(f)匹配B的不匹配f的所有元素
B:parent匹配B的子元素不为空的元素
B:password匹配B的类型为input[type=password]的元素
B:radio匹配B的类型为input[type=radio]的元素
B:reset匹配B的类型为input[type=reset]或 button[type=reset]的元素
B:submit匹配B的所有类型input[type=submit] or button[type=submit]的元素
B:selected匹配B的状态为选中状态的元素,仅<option>拥有此状态
B:text匹配B的所有类型为input[type=text]的元素
B:visible匹配B的所有状态可见的元素


示例:

语句说明
$(“img:animated”)selects all <img> elements that are undergoing animation
$(“:button:hidden”)selects all button type elements that are hidden
$(“input[name=myRadioGroup]:radio:checked”)selects all radio elements with the name attribute value of myRadioGroup that are checked
$(“:text:disabled”)selects all text fields that are disabled
$(“#xyz p :header”)selects all header type elements within <p> elements that are within an element with an id value of xyz. Note the space before :header that prevents it from binding directly to the p.
$(“option:not(:selected)”)selects all unselected <option> elements
$(“#myForm button:not(.someClass)”)selects all buttons from the <form> with the id of myForm that do not possess the class name someClass.
$(“select[name=choices] :selected”)selects the selected <option> elements within the <select> element named choices.
$(“p:contains(coffee)”)selects all <p> elements that contain the text coffee


https://dzone.com/refcardz/jquery-selectors

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值