演示-JQuery属性选择器
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>index</title>
<script type="text/javascript" src="jquery-3.1.1.min.js"> </script>
<script type="text/javascript">
$(function(){
console.log("选择器“p[align]”长度为:"+$("p[align]").length);
console.log("选择器“p[align='center']”长度为:"+$("p[align='center']").length);
console.log("选择器“p[title='hellohtmlworld']t”长度为:"+$("p[title='hellohtmlworld']").length);
console.log("选择器“p[title^='hello ']”长度为:"+$("p[title^='hello ']").length);
console.log("选择器“p[title$='world']”长度为:"+$("p[title$='world']").length);
console.log("选择器“p[title*='html']”长度为:"+$("p[title*='html']").length);
console.log("选择器“p[title~='hello']”长度为:"+$("p[title~='hello']").length);
console.log("选择器“p[title|='hello']”长度为:"+$("p[title|='hello']").length);
console.log("选择器[href^='http'][title='hello-html-world']”长度为:"+$("[href^='http'][title='hello-html-world']").length);
}
);
</script>
</head>
<body>
<div>
<p align="center">hello world!</p>
<p align="">hello world!</p>
</div>
<div class="test" id="test" align="" style="background-color:#CCCCCC">
<p class="test" title="hello">hello world!</p>
<p class="test" title="hello html world">hello world!</p>
<p class="test1" title="hellohtmlworld">hello world!</p>
<p class="test1" title="hello-html-world">hello world!</p>
<a class="test1" title="hello-html-world" href="http://www.cnblogs.com/yw0219/p/5928955.html">JQuery选择器</a>
</div>
</body>
</html>
结果:

演示-JQuery属性选择器的更多相关文章
- jquery 属性选择器
jquery 属性选择器 第一种根据属性选择E[attr] $("[title]").click().......... 即选择所有元素内 属性带有title的元素即<l ...
- jquery-6 jquery属性选择器
jquery-6 jquery属性选择器 一.总结 一句话总结:jquery操作就是选择器加jquery对象的各种方法. 1.大量操作样式用什么方式? 大批量样式通过加类和减类完成 2.jquery中 ...
- jquery属性选择器(同时匹配多个条件)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- jquery属性选择器
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- jquery属性选择器(匹配具有指定属性的元素)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- jQuery属性选择器.attr()和.prop()两种方法
在判断表单单选框是否被选中时,通常会想到使用$('#checkbox').attr('checked')来判断,但在一些情况下,你会发现这种方法并不管用,得到的是undefined. 原来jQuery ...
- Jquery 属性选择器&设置元素属性
什么是属性选择器呢?感觉理解起来有点难,举个例子就很容易明白了,<div id="ajaxa"></div>这里的id就是属性,这下就很容易理解了, jqu ...
- jquery属性选择器中|value和^value的区别
jquery的属性选择中有两个比较混淆:一个是[attribute^value], 另一个是[attribute|value]. 先看解释: [attribute^value]:选取属性的值以valu ...
- Jquery属性选择器(同时匹配多个条件,与或非)(附样例)
1. 前言 为了处理除了两项不符合条件外的选择,需要用到jquery选择器的多个条件匹配来处理,然后整理了一下相关的与或非的条件及其组合. 作为笔记记录. 2. 代码 <!DOCTYPE htm ...
随机推荐
- C#操作txt文件并清空添加操作
C#操作txt文件,进行清空添加操作的例子.代码: //把txt清空 FileStream stream = File.Open(Adr,FileMode.OpenOrCreate,FileAcces ...
- WIN10中运行ASP出错
一个项目用ASP做的,想在WIN中IIS建立网站部署起来,开始怎么弄都不行,运行总是出现那句英文,后来才知道要在IIS中的网站的ASP选项中的调试属性中把发送错误到到浏览器打开,这样才能发现程序报错, ...
- 在线升级java的版本
真接rpm包安装javaxxxx.rpm 然后调整/etc/profile 如下: # tail -n /etc/profile JAVA_HOME=/usr/java/jdk1..0_45 PATH ...
- C# RSA数据加密
第一步产生密钥类 CreateKey using System; using System.Collections.Generic; using System.Linq; using System.T ...
- version `GLIBC_2.14' not found 解决方法.
from http://blog.csdn.net/force_eagle/article/details/8684669 version `GLIBC_2.14' not found 解决方法. 一 ...
- 重装Ubuntu系统
1.安装JDK参考:http://weixiaolu.iteye.com/blog/1401786jdk-6u31-linux-i586.bin莫名奇妙的安装失败.所以下载了jdk-7u45-linu ...
- printf家族探秘
有一个函数,是我们从学习c语言就开始的第一天就接触的,那就是printf函数,可是这个家族的函数,带给我们的便利却不是一点半点,所以写一篇用法总结. 1.printf函数 格式化输出,可以输出八进制, ...
- Eclipse下把jar包放到工程lib下和通过buildpath加载有什么不同(解决找不到类的中级方法)
我通过Eclipse的 User Libranry 将jar导入 Eclipse里面,编译没有问题,运行的时候就报class文件没有定义,后来上网上查了下,原因找到啦,是这样的: 用Java Buil ...
- Spring 网路搜集的情报
Spring Validate http://haohaoxuexi.iteye.com/blog/1812584
- java继承2——类与继承(转)
一.你了解类吗? 在Java中,类文件是以.java为后缀的代码文件,在每个类文件中最多只允许出现一个public类,当有public类的时候,类文件的名称必须和public类的名称相同,若不存在pu ...