1、jquery的优点
jQuery 是轻量级的框架,大小不到 30kb;
它有强大的选择器,出色的 DOM 操作的封装,有可靠的事件处理机制;
完善的 ajax,出色的浏览器的兼容性;
而且支持链式操作,隐式迭代。
行为层和结构层的分离,还支持丰富的插件,jquery 的文档也非常的丰富。
2、jQuery中有哪几种类型的选择器?
基本选择器:直接根据 id、CSS 类名、元素名返回匹配的 DOM 元素。
层次选择器:也叫做路径选择器,可以根据路径层次来选择相应的 DOM 元素。parent > child,prev + next ,prev ~ siblings
表单选择器: :input ,:text ,:password ,:radio ,:checkbox ,:submit 等;
过滤选择器:在前面的基础上过滤相关条件,得到匹配的 DOM 元素。
基本过滤器选择器::first,:last ,:not ,:even ,:odd ,:eq ,:gt ,:lt
内容过滤器选择器: :contains ,:empty ,:has ,:parent
可见性过滤器选择器::hidden ,:visible
属性过滤器选择器:[attribute] ,[attribute=value] ,[attribute!=value] ,[attribute^=value] ,[attribute$=value] ,[attribute*=value]
子元素过滤器选择器::nth-child ,:first-child ,:last-child ,:only-child
表单过滤器选择器::enabled ,:disabled ,:checked ,:selected
Eg:找到所有 HTML select 标签的选中项
<select name="n_select" class="c_select" id="i_select1">
$('[name=n_select] :selected');
3、jquery中的选择器 和 css 中的选择器有区别吗?
jQuery 选择器支持 CSS 里的选择器,
jQuery 选择器可用来添加样式和添加相应的行为