<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
<meta charset="utf-8" />
    <script src="jquery-3.3.1.js"></script>
    <script>
        $(function () {
            $('#btn').click(function () {
                //有id属性的div
                //$('div[id]').css('backgroundColor', 'blue');

                //获取有id属性的div并且id属性为dv1
                //$('div[id=dv1]').css('backgroundColor', 'blue');

                //$('input[name=name]').css('backgroundColor', 'blue');
                //$('input[name!=name]').css('backgroundColor', 'blue');
                //name属性必须以name开头的
                //$('input[name^=name]').css('backgroundColor', 'blue');
                //name属性必须以name结尾的
                //$('input[name$=name]').css('backgroundColor', 'blue');
                //name属性包含name的              
                //$('input[name*=name]').css('backgroundColor', 'blue');
                //含有name和value属性的
                $('input[name][value]').css('backgroundColor', 'blue');
            });
            
        })
    </script>
    <style>
        div{
            width:300px;
            height:200px;
            background-color:orange;
            margin-bottom:20px;
        }
    </style>
</head>
<body>
    <input type="button" name="name" value="显示效果" id="btn" />
    <input type="text" name="1name1" value="" />
    <input type="text" name="2name2" value="" />
    <input type="text" name="name3" value="" />
    <input type="text" name="name4" value="" />
    <div id="dv1">

    </div>
    <div>

    </div>
    <div id="dv2">

    </div>
</body>
</html>

jquery属性过滤器的更多相关文章

  1. jQuery属性/CSS使用例子

    jQuery属性/CSS 1..attr() 获取匹配的元素集合中的第一个元素的属性的值  或 设置每一个匹配元素的一个或多个属性. 例1:获取元素的属性的值 <p title="段落 ...

  2. jQuery源代码学习之八——jQuery属性操作模块

    一.jQuery属性模块整体介绍 jQuery的属性操作模块分四个部分:html属性操作,dom属性操作,类样式操作,和值操作. html属性操作(setAttribute/getAttribute) ...

  3. grootJs 属性过滤器

    index10.html <html><head> <title>属性过滤器</title> <script src="jquery-1 ...

  4. fastjson格式化bean的简易属性过滤器

    fastjson的bean属性过滤器 有的时候,我们在接口开发时,一个完整的bean会包含很多属性,但是前端接口只需要其中的某几个属性时,应该在对json的返回要进行精简.下面直接看代码 packag ...

  5. jQuery 属性操作和CSS 操作

    如有在jQuery方法中涉及到函数,此函数必定会返回一个数值(函数由于运行次数不同触发一些不同效果) jQuery 属性操作方法(以下方法前些日子学习过,不再赘述) addClass() attr() ...

  6. jQuery内容过滤器

    jQuery内容过滤器 <h1>this is h1</h1> <div id="p1"> <h2>this is h2</h ...

  7. jQuery属性操作总结

    jquery属性包括以下几个: attr(name|pro|key,val|fn) removeAttr(name) prop(n|p|k,v|f)1.6+ removeProp(name)1.6+ ...

  8. jQuery 效果函数,jquery文档操作,jQuery属性操作方法,jQuerycss操作函数,jQuery参考手册-事件,jQuery选择器

    jQuery 效果函数 方法 描述 animate() 对被选元素应用“自定义”的动画 clearQueue() 对被选元素移除所有排队的函数(仍未运行的) delay() 对被选元素的所有排队函数( ...

  9. jquery属性值选择器

    $("[attribute|='value']") 选择指定属性值等于给定字符串或改字符串为前缀(该字符串后跟一个连字符“-”)的元素. attribute: 一个属性名 valu ...

随机推荐

  1. mysql去除字段内容的空格和换行回车

    MySQL 去除字段中的换行和回车符 解决方法:          UPDATE tablename SET field = REPLACE(REPLACE(field, CHAR(10), ''), ...

  2. 【34.25%】【BZOJ 2648】SJY摆棋子

    Time Limit: 20 Sec  Memory Limit: 128 MB Submit: 2718  Solved: 931 [Submit][Status][Discuss] Descrip ...

  3. html页面保存数的两种方式

    原文链接:https://blog.csdn.net/qq_37936542/article/details/78866755 需求:微信开发时,在某个页面授权获取用户的openid,但是每次刷新页面 ...

  4. [WebGL入门]十三,minMatrix.js和坐标变换矩阵

    注:文章译自http://wgld.org/,原作者杉本雅広(doxas),文章中假设有我的额外说明,我会加上[lufy:],另外,鄙人webgl研究还不够深入,一些专业词语,假设翻译有误,欢迎大家指 ...

  5. js进阶 9-8 html标签如何实现禁止复制和粘贴

    js进阶 9-8  html标签如何实现禁止复制和粘贴 一.总结 一句话总结: 1.在oncopy方法中return false即可阻止在控件中复制内容 2.在onpaste方法中return fal ...

  6. T-SQL部分函数(转)

    函数类别 作用 聚合函数 执行的操作是将多个值合并为一个值.例如 COUNT.SUM.MIN 和 MAX. 配置函数 是一种标量函数,可返回有关配置设置的信息. 转换函数 将值从一种数据类型转换为另一 ...

  7. tensorflow 函数接口的理解

    1. tf.nn.softmax tf.nn.softmax(logits, dim=-1, name=None) w*x+b ⇒ logits softmax 函数执行的操作:exp(logits) ...

  8. Tomcat下部署SpringBoot

    SpringBoot默认支持Tomcat7及以上版本(SpringBoot默认支持servlet3.1版本及以上,Tomcat6只支持到servlet2.5) 测试环境:jdk1.8 + tomcat ...

  9. Cordova-Android-Android target:not installed

    原文:Cordova-Android-Android target:not installed 运行cordova requirements检查是否具备使用 Cordova 开发/运行 Android ...

  10. base64编码转图片

    protected void Button1_Click(object sender, EventArgs e) { //strImg为base64编码的图片字符串 string strImg = & ...