jquery的选择器有几种?

jQuery是一个简洁而快速的JavaScript库,可用于简化事件处理,HTML文档遍历,Ajax交互和动画,以便快速开发网站。目的是让开发者更容易地在网站上使用JavaScript。

jQuery是一个快速、简洁的JavaScript框架,是继Prototype之后又一个优秀的JavaScript代码库(或JavaScript框架)。jQuery设计的宗旨是“write Less,Do More”,即倡导写更少的代码,做更多的事情。它封装JavaScript常用的功能代码,提供一种简便的JavaScript设计模式,优化HTML文档操作、事件处理、动画设计和Ajax交互。

jQuery的核心特性可以总结为:具有独特的链式语法和短小清晰的多功能接口;具有高效灵活的css选择器,并且可对CSS选择器进行扩展;拥有便捷的插件扩展机制和丰富的插件。jQuery兼容各种主流浏览器,如IE 6.0+、FF 1.5+、Safari 2.0+、Opera 9.0+等。

jquery的选择器有几种?

很多种,大概归纳为9种。

1、基本

  • #id

  • element

  • .class

  • *

  • selector1,selector2,selectorN

2、层次选择器:

  • ancestor descendant

  • parent > child

  • prev + next

  • prev ~ siblings

3、基本过滤器选择器

  • :first

  • :last

  • :not

  • :even

  • :odd

  • :eq

  • :gt

  • :lt

  • :header

  • :animated

4、内容过滤器选择器

  • :contains

  • :empty

  • :has

  • :parent

5、可见性过滤器选择器

  • :hidden

  • :visible

6、属性过滤器选择器

  • [attribute]

  • [attribute=value]

  • [attribute!=value]

  • [attribute^=value]

  • [attribute$=value]

  • [attribute*=value]

  • [attrSel1][attrSel2][attrSelN]

7、子元素过滤器选择器

  • :nth-child

  • :first-child

  • :last-child

  • :only-child

8、表单选择器

  • :input

  • :text

  • :password

  • :radio

  • :checkbox

  • :submit

  • :image

  • :reset

  • :button

  • :file

  • :hidden

9、表单过滤器选择器

  • :enabled

  • :disabled

  • :checked

  • :selected

更多web前端开发知识,请查阅 HTML中文网 !!

以上就是jquery的选择器有几种?的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » jQuery 答疑