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 ...
随机推荐
- pandas 学习(五)—— datetime(日期)
date range pd.date_range('2014-11-19', '2014-11-21', freq='D') # 起始时间,终止时间,时间间隔,也即步长,D ⇒ Day,5H:以 5 ...
- java File类的基本使用
package com.soar.file; import java.io.File; import java.io.IOException; public class Demo2_FileMetho ...
- [E2E] Robot Framework introduction
We will use demo project as an example, go though QuickStart repo. Install: First you should have py ...
- STS 3.6.4 SpringMVC 4.1.6 Hibernate 4.3.8 MySQL
开发环境: Java 1.8 Spring Tool Suite 3.6.4 Spring faramework 4.1.6 Hibernate 4.3.8 Maven 2.9 数据库是MySQL 5 ...
- android studio怎么添加.so文件?android studio加载so文件的方法
android studio 中 添加.so 文件,Android Studio中添加.jar文件和.so文件无疑是一件很重要也是很头疼的问题! 1.在src/main中添加 jniLibs文件夹 , ...
- 【u017】请柬
Time Limit: 1 second Memory Limit: 128 MB [问题描述] 在电视时代,没有多少人观看戏剧表演.Malidinesia古董喜剧演员意识到这一事实,他们想宣传剧院, ...
- [GraphQL] Add an Interface to a GraphQL Schema
As we start building out more complex GraphQL schemas, certain fields start to repeat across differe ...
- js进阶 11-2 jquery属性如何操作
js进阶 11-2 jquery属性如何操作 一.总结 一句话总结:jquery中的属性用attr方法表示.jquery中都是方法. 1.jquery中的属性的增删改查操作? 只需要两个方法, at ...
- [自学AndroidStudio系列]第二篇章:高速上手AS小技巧其一
事实上看过第一篇的文章的人可能发现了,这个系列实际上是针对,有android开发经验的,之前使用Eclipse的开发人员;所以,避免无谓的口舌,直接进入说重点吧; 关闭项目自己主动打开 AS会自己主动 ...
- js进阶 9-10 html控件如何实现点击自动选择控件内容
js进阶 9-10 html控件如何实现点击自动选择控件内容 一.总结 一句话总结: 1.在click事件中,如果focus,那就select 2.blur 1.html中控件添加两种方式? 在表单 ...