美文网首页
jquery选择器

jquery选择器

作者: PureCaprice | 来源:发表于2017-09-05 21:11 被阅读0次

内容过滤选择器

:contains(" ")       元素包含某个内容

:empt                   为空的元素

:parent                 不为空的元素

:has("p")              有p元素的

显示与隐藏

.hide(时间,回调函数)

.show(时间,回调函数)

.fadeIn(时间,回调函数)

.fadeOut(时间,回调函数)

.fadeTo(时间,透明度(0-1),回调函数)

.fadeToggle(时间,回调函数)

// 1.6以上的版本

.slideDown(时间,回调函数)

.slideUp(时间,回调函数)

.slideToggle(时间,回调函数)

.toggle(时间,回调函数)

//       时间:normal / slow / fast /  毫秒

//     回调函数:当动画执行完毕后执行的函数

内容添加

html()  支持html的标签

text()   任何东西都转换为文本

val()   获取表单值

val(2)   设置表单值为2

层次选择器

向上找:

           parent   父元素              parents  父辈元素

向下找:

           find()  在子元素或孙元素找            children()   在子元素找

兄弟:

          next()  下一个兄弟          nextAll()   后面所有兄弟

          prev()  下一个兄弟          prevAll()  后面所有兄弟

         siblings()  所有兄弟

css属性值

        css()   获取属性值

        css(“属性”,“属性值”)  设置属性值

      css({"属性1":"属性值1","属性2":"属性值2"})  设置多个属性值

辅助选择器

      .filter()  

      .last

      .first

      .not() 

      .eq() 

      .get()

内部添加

a.append(b)  把a添加到b内部最后边

a.prepend(b)  把a添加到b内部最前边

a.appendTo(b)  把b添加到a内部最前边

a.prependTo(b)  把b添加到a内部最前边

外部插入

A.after(B)  把A添加到B外部最后边

A.before(B)  把A添加到B外部最前边

A.innerAfter(B)  把B添加到A外部最后边

A.innerBefore(B)  把B添加到A外部最前边

删除

remove()  删除                empty()  清除内容

复制

clone()  克隆                  clone(ture)  克隆功能

替换

A.replaceWith(B)  把A替换成B

A.replaceAll(B)  把B替换成A

包装与解报装

a.wrap("<div>")  把a用div包装起来

a.unwrap()   去掉一层父亲元素

a.wrapInner(<i>)  在a里插入一个标签i

on添加事件

on(事件名,子选择器,函数)

//    动态元素也可以有事件

属性的设置

.attr("属性")  获取属性值

.attr(“属性”,“属性值”)  设置属性值

.attr({"属性1":"属性值1","属性2":"属性值2"})  设置多个属性值

相关文章

  • jquery选择器书目录

    jquery选择器-基本选择器 jquery选择器-层级选择器 jquery选择器-基本过滤选择器 jquery选...

  • JQUERY一

    jQuery 元素选择器 jQuery 属性选择器 jQuery CSS 选择器 jQuery 事件 jQuery...

  • jQuser有选择器

    jQuery基本选择器 jQuery过滤选择器 jQuery层级选择器 jQuery筛选选择器(方法)

  • 选择器

    jQuery 元素选择器 jQuery 属性选择器 jQuery CSS 选择器

  • jQuery 基础

    jQuery jQuery操作DOM jQuery的选择器 基本选择器 层级选择器 过滤选择器 jQuery操作样...

  • jQuery

    jQuery jQuery操作DOM jQuery的选择器 基本选择器 层级选择器 过滤选择器 jQuery操作样...

  • jQuery选择器

    一、jQuery常用选择器 二、jQuery选择器优势 三、jQuery常用基本选择器 四、jQuery常用层次选...

  • JQuery基础知识

    jQuery操作DOM jQuery的选择器 基本选择器 层级选择器 过滤选择器 jQuery操作样式 css操作...

  • jQuery相关知识

    1、什么是jQuery选择器? jQuery选择器

  • jQuery选择器

    jQuery选择器 jQuery选择器完全继承了CSS的风格。学会使用选择器是学习jQuery的基础,jQuery...

网友评论

      本文标题:jquery选择器

      本文链接:https://www.haomeiwen.com/subject/stfpjxtx.html