jquery属性过滤器
<!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属性过滤器的更多相关文章
- jQuery属性/CSS使用例子
jQuery属性/CSS 1..attr() 获取匹配的元素集合中的第一个元素的属性的值 或 设置每一个匹配元素的一个或多个属性. 例1:获取元素的属性的值 <p title="段落 ...
- jQuery源代码学习之八——jQuery属性操作模块
一.jQuery属性模块整体介绍 jQuery的属性操作模块分四个部分:html属性操作,dom属性操作,类样式操作,和值操作. html属性操作(setAttribute/getAttribute) ...
- grootJs 属性过滤器
index10.html <html><head> <title>属性过滤器</title> <script src="jquery-1 ...
- fastjson格式化bean的简易属性过滤器
fastjson的bean属性过滤器 有的时候,我们在接口开发时,一个完整的bean会包含很多属性,但是前端接口只需要其中的某几个属性时,应该在对json的返回要进行精简.下面直接看代码 packag ...
- jQuery 属性操作和CSS 操作
如有在jQuery方法中涉及到函数,此函数必定会返回一个数值(函数由于运行次数不同触发一些不同效果) jQuery 属性操作方法(以下方法前些日子学习过,不再赘述) addClass() attr() ...
- jQuery内容过滤器
jQuery内容过滤器 <h1>this is h1</h1> <div id="p1"> <h2>this is h2</h ...
- jQuery属性操作总结
jquery属性包括以下几个: attr(name|pro|key,val|fn) removeAttr(name) prop(n|p|k,v|f)1.6+ removeProp(name)1.6+ ...
- jQuery 效果函数,jquery文档操作,jQuery属性操作方法,jQuerycss操作函数,jQuery参考手册-事件,jQuery选择器
jQuery 效果函数 方法 描述 animate() 对被选元素应用“自定义”的动画 clearQueue() 对被选元素移除所有排队的函数(仍未运行的) delay() 对被选元素的所有排队函数( ...
- jquery属性值选择器
$("[attribute|='value']") 选择指定属性值等于给定字符串或改字符串为前缀(该字符串后跟一个连字符“-”)的元素. attribute: 一个属性名 valu ...
随机推荐
- 线上java排查
http://www.oschina.net/question/560995_137855?sort=default&p=3#answers http://www.blogjava.net/h ...
- struts2基本的配置代码
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "- ...
- MethodInterceptor拦截器
http://blog.csdn.net/heirenheiren/article/details/39030767
- 【转】priority_queue的用法
http://www.cnblogs.com/flyoung2008/articles/2136485.html priority_queue调用 STL里面的 make_heap(), pop_he ...
- 定义变量let,const
1.块级作用域let 声明变量,作用域是最近的"{}": 'use strict'; { let test = '1'; } console.log(test);//test is ...
- 热烈庆祝UE4完全免费Free---GitHub上源码的关联方法
声明:所有权利保留. 转载请说明出处:http://blog.csdn.net/cartzhang/article/details/44040317 IF YOU LOVE SOMETHING, SE ...
- Swift学习——Swift解释具体的基础(六)
Optionals 可选 可选(它似乎并不如此翻译)它适用于那些值这种情况可能是空的,有两种情况一个可选:存在值并等于x,要么值不存在. 选配的概念在OC和C里面并没有.在OC中最接近的概念就是 ...
- .net remoting 使用事件
原文:.net remoting 使用事件 在RPC如果需要使用事件,相对是比较难的.本文告诉大家如何在 .net remoting 使用事件. 目录 使用 Channel 序列化 开发建议 修复异常 ...
- C++于public、protected和private说明(From MSDN)
public(C# 參考): https://msdn.microsoft.com/zh-cn/library/yzh058ae.aspx protected(C# 參考):https://msdn. ...
- centos 6 防火墙开启端口无效问题
昨天尝试redis在centos的安装,配置文件都检查了,外网就是不能访问 #添加端口开启 $ iptables -A INPUT -p tcp --dport 6379 -j ACCEPT #保存配 ...