`
KAXU
  • 浏览: 266947 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

jquery 属性 removeAttr(name)

阅读更多

removeAttr(name)

删除匹配集合中每个元素的属性‘name’

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  
  <script>
  $(document).ready(function(){
    
    $("button").click(function () {
      $(this).next().removeAttr("disabled")
             .focus()
             .val("editable now");
    });

  });
  </script>
  
</head>
<body>
  <button>Enable</button>
  <input type="text" disabled="disabled" value="can't edit this" />
</body>
</html>

 

$(this).next().removeAttr("disabled")
删除input元素中disabled属性。以下为删除属性

<input type="text" disabled="disabled" value="can't edit this" />

分享到:
评论

相关推荐

    jQuery中removeAttr()方法用法实例

    本文实例讲述了jQuery中removeAttr()方法用法。分享给大家供大家参考。具体分析如下: 此方法从匹配元素中移除相应的属性。 语法结构: 代码如下:$(selector).removeAttr(attribute) 参数列表: 参数 描述 ...

    jQuery源码解读之removeAttr()方法分析

    //name,传入要DOM元素要移除的属性名。  removeAttr: function( name ) { //使用jQuery.fn对象,即jQuery原型对象的each方法遍历当前选择器选择的jQuery对象数组,并返回该jQuery对象以便链式调用。  return this...

    jQuery帮助文档

    removeAttr(name) CSS 类 addClass(class) removeClass([class]) toggleClass(class [, switch]) HTML代码 html( [val] ) 文本 text( [val] ) 值 val( [val] ) CSS CSS css(name) css(properties) css(name...

    JQuery 1.4.1 API Reference 速查手册.chm

    核心 jQuery 核心函数 jQuery(expr, [context]) jQuery(html, [ownerDoc]) jQuery(html, props) jQuery(elements) jQuery() ...removeAttr(name) CSS 类 addClass(class | fn) removeClass([class |

    jQuery学习笔记 操作jQuery对象 属性处理

    还可以使用函数作为参数,将函数返回值作为需要为元素属性设置的值,比如将第(index+1)个元素的name属性设置为函数返回值(实际上,明白函数式就根本不需要这说明)。也可以一次性给同一元素多个属性 removeAttr...

    JQuery新版中文手册

    removeAttr(name) prop(name|pro|key,val|fn)1.6+ removeProp(name)1.6+ CSS 类 addClass(class|fn) removeClass([class|fn]) toggleClass(class|fn[,sw]) HTML代码/文本/值 html([val|fn]) text([val|fn])...

    jQuery 1.4.1 中文参考

    4.1.5 removeAttr(name) 64 4.2 CSS 类 64 4.2.1 addClass(class) 64 4.2.2 addClass(function(index, class)) 65 4.2.3 removeClass([class]) 65 4.2.4 removeClass(function(index, class)) 66 4.2.5 toggleClass...

    解决jquery实现的radio重新选中的问题

    使用 jquery 的removeAttr(),清除掉 radio 的checked属性后。使用 attr(‘checked’,true)可以给对应的radio 附上 checked属性。但是页面展示,却没有选中。 解决方法:  使用原生js 代码实现。  var inputList =...

    jQuery 1.5 API 中文版

    $.removeAttr( name ) Class $.addClass( class ), .addClass( fn(index, class) ) bool.hasClass( class ) $.removeClass( [class] ), .removeClass( fn(index, class) ) $.toggleClass( class [, switch] ), ....

    jQuery 1.6.3正式版发布

    #9699:修复webkit内核浏览器中removeAttr('tyle')不能准确移除style属性的问题。 #9719:修复IE6中removeAttr('disabled')不能改变输入框颜色的问题。 #9979:修复.prop(‘tabIndex’) 可能返回错误结果的问题。 #...

    jQuery使用元素属性attr赋值详解

    代码如下: 1.$(“Element”).attr(name) ‘取得第一个匹配的属性值,比如$(“img”).attr(“src”)  2.$(“Element”.attr(key,...5.$(“Element”).removeAttr(name)//移除某一个属性  jQuery 代码: 代码如下: $

    jQuery完全实例.rar

    jQuery1.2 API 中文版折叠展开折叠全部展开全部 英文说明 核心jQuery 核心函数 jQuery(expression,[context]) jQuery(expression,[context]) 这个函数接收一个包含 CSS 选择器的字符串,然后用这个字符串去匹配一组...

    jQuery详细教程

    jQuery 使用 XPath 表达式来选择带有给定属性的元素。 $("[href]") 选取所有带有 href 属性的元素。 $("[href='#']") 选取所有带有 href 值等于 "#" 的元素。 $("[href!='#']") 选取所有带有 href 值不等于 "#" 的...

    Jquery 1.3 简体中文手册

    removeAttr(name) CSS 类 addClass(class) removeClass([class]) toggleClass(class [, switch]) HTML代码 html( [val] ) 文本 text( [val] ) 值 val( [val] ) CSS CSS css(name) css(properties) css(name...

    JQuery 1.3 中文参考手册

    removeAttr(name) CSS 类 addClass(class) removeClass([class]) toggleClass(class [, switch]) HTML代码 html( [val] ) 文本 text( [val] ) 值 val( [val] ) CSS CSS css(name) css(properties) css(name...

    jquery1.11.0手册

    removeAttr(name) prop(n|p|k,v|f) removeProp(name) CSS 类 addClass(class|fn) removeClass([class|fn]) toggleClass(class|fn[,sw]) HTML代码/文本/值 html([val|fn]) text([val|fn]) val([val|fn|arr...

    jQuery中children()方法用法实例

    本文实例讲述了jQuery中children()方法用法。分享给大家供大家参考。具体分析如下: 此方法取得一个包含匹配元素集合中每一个元素的所有子元素的元素集合。 可以通过可选的表达式来过滤所匹配的子元素。 注意:find()...

Global site tag (gtag.js) - Google Analytics