<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html lang="en"><!-- Source is http://training.learningjquery.com/select-css.html -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Selectors</title>
<link rel="stylesheet" href="http://codylindley.com/jqueryselectors/select.css" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>
<script src="http://codylindley.com/jqueryselectors/select.js" type="text/javascript"></script>
<script src="http://codylindley.com/jqueryselectors/jquery.DOMWindow.js" type="text/javascript"></script>
</head>

<body>
<div id="container">
<p style="margin:0;"><small>Original lab by <a href="http://www.learningjquery.com/" target="_blank" >Karl Swedberg</a> Enhanced by <a href="http://www.codylindley.com">Cody Lindley</a>. FYI (ie6 != supported)</small></p>
<div class="section">
<h1>jQuery Selectors</h1>

<div class="domtree">
<h3>Toggle Button = <code>$('selector').addClass('highlight').animate({ marginLeft: 10}, 'fast');</code></h3>
<p><a href="http://www.codylindley.com/jqueryselectors/jqueryselectors.zip" title="Download This Lab" rel="">Download This Lab</a></p>
<div id="myid">This sentence is in <code>&lt;div id="myid"&gt;</code>. It is followed by a horizontal rule.</div>
<hr />
<p>This is a paragraph, which means it is wrapped in <code>&lt;p&gt;</code> <span>and</span> <code>&lt;/p&gt;</code>. Those "p" tags in the previous sentence are formatted as <code>&lt;code&gt;</code>.</p>
<ul>
<li>This is the first list item (<code>&lt;li&gt;</code>) in an unordered list (<code>&lt;ul&gt;</code>). </li>
<li>This is the second list item. It has a <a rel="self" title="Learning jQuery blog" href="/archives/jquery-links.htm">link</a> in it.</li>
<li class="myclass otherclass">This is the third list item. It has a <code>class</code> of "myclass otherclass"</li>
<li>This is the fourth list item. It has <strong>strong</strong> text and <em>em</em>phasized <em>text</em>.
<ul>
<li>second-level list item 1</li>
<li>second-level list item 2</li>
</ul>
</li>
</ul>
<p class="myclass"><code>&lt;p class="myclass"&gt;</code>This is another paragraph. It has class="myclass" Otherwise, nothing <strong>special</strong> about it at all.</p>

<p>This is a paragraph, which means it is wrapped in <code>&lt;p&gt;</code> and <code>&lt;/p&gt;</code>. Those "p" tags in the previous sentence are formatted as &lt;code&gt;.</p>
<form action="examples_submit" method="get" accept-charset="utf-8">
<div class="left">

<div><input type="text" value="text input" /></div>
<div><input type="text" value="disabled text input" disabled="disabled" /></div>
<div><input type="password" name="password" value="password" /></div>
<div><select>
<option>select list w/ options</option>
<option>another option</option>
<option>a third option</option>
</select>
</div>
</div>
<textarea class="left" rows="5" cols="20">This is a textarea</textarea>
<div><select size="5" style="margin-left:10px">
<option>select list w/ options</option>
<option selected="selected">another option</option>
<option>a third option</option>
</select></div>
<div class="clear-left"><label for="radio1">
<input class="left" name="radiobtn" type="radio" id="radio1" value="checkedradio" checked="checked" />
Radio Checked
</label>
<label class="left clear-left" for="radio2">
<input class="left" id="radio2" name="radiobtn" type="radio" value="not" />
Radio Not Checked
</label>
<label class="left clear-left" for="check1">
<input class="left" id="check1" name="checkbx" type="checkbox" value="checked" checked="checked" />
Checkbox Checked
</label>
<label class="left clear-left" for="check2">
<input class="left" id="check2" name="checkbx" type="checkbox" value="not" />
Checkbox Not Checked
</label>
<label class="left clear-left" for="check3">
<input class="left" id="check3" name="checkbx" type="checkbox" value="not" />
Another checkbox Not Checked
</label>
</div>

<div class="left clear-left"><input type="submit" value="Submit input" /></div>
<div class="left"><input type="button" value="Button input" /></div>
<div class="left"><input type="reset" value="Reset input" /></div>
<div class="left"><input type="image" src="select-form_files/image.gif" value="Image input" /></div>
<div class="left"><button>Button button</button></div>
<div class="left clear-left"><input type="file" name="fileinput" value="file input" id="fileinput" /></div>
</form>
</div>

<div class="example">
<h3>Enter Your Own Selectors ( example: li:nth-child(2) )</h3>
<textarea rows="3" id="customInput" style="width:250px;">li:nth-child(2)</textarea>
<input type="submit" value="toggle" id="toggleCustom" />
</div>

<div class="example">
<h3>Basics</h3>
<div class="content">
<div class="sample-code">$('<span class="querystring">code</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/element#element" />
<div class="sample-code">$('<span class="querystring">#myid</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/id#id" />
<div class="sample-code">$('<span class="querystring">.myclass</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/class#class" />
<div class="sample-code">$('<span class="querystring">*</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/all" />
<div class="sample-code">$('<span class="querystring">code, #myid, .myclass</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/multiple#selector1selector2selectorN" />
</div>
</div>

<div class="example">
<h3>Hierarchy</h3>
<div class="content">
<div class="sample-code">$('<span class="querystring">div code</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/descendant#ancestordescendant" />
<div class="sample-code">$('<span class="querystring">li > ul</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/child#parentchild" />
<div class="sample-code">$('<span class="querystring">strong + em</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/next#prevnext" />
<div class="sample-code">$('<span class="querystring">strong ~ em</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/siblings#prevsiblings" />
</div>
</div>

<div class="example">
<h3>Basic Filters</h3>
<div class="content">
<div class="sample-code">$('<span class="querystring">li:first</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/first" />
<div class="sample-code">$('<span class="querystring">li:last</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/last" />
<div class="sample-code">$('<span class="querystring">li:not(li:first)</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/not#selector" />
<div class="sample-code">$('<span class="querystring">li:even</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/even" />
<div class="sample-code">$('<span class="querystring">li:odd</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/odd" />
<div class="sample-code">$('<span class="querystring">li:eq(1)</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/eq#index" />
<div class="sample-code">$('<span class="querystring">li:gt(2)</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/gt#index" />
<div class="sample-code">$('<span class="querystring">li:lt(2)</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/lt#index" />
<div class="sample-code">$('<span class="querystring">:header</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/header" />
<div class="sample-code">$('<span class="querystring">:animated</span>')</div>
<input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/animated" />
</div>
</div>

<div class="example">
<h3>Content Filters</h3>
<div class="content">
<div class="sample-code">$('<span class="querystring">li:contains(second-level)</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/contains#text" />
<div class="sample-code">$('<span class="querystring">:empty</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/empty" />
<div class="sample-code">$('<span class="querystring">li:has(a)</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/has#selector" />
<div class="sample-code">$('<span class="querystring">p:parent</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/parent" />
</div>
</div>

<div class="example">
<h3>Visibility Filters</h3>
<div class="content">
<div class="sample-code">$('<span class="querystring">:hidden</span>')</div>
<input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/hidden" />
<div class="sample-code">$('<span class="querystring">:visible</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/visible" />
</div>
</div>

<div class="example">
<h3>Attribute Filters</h3>
<div class="content">
<div class="sample-code">$('<span class="querystring">li[class]</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/attributeHas#attribute" />
<div class="sample-code">$('<span class="querystring">a[rel="self"]</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/attributeEquals#attributevalue" />
<div class="sample-code">$('<span class="querystring">a[rel!="nofollow"]</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/attributeNotEqual#attributevalue" />
<div class="sample-code">$('<span class="querystring">[class^="my"]</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/attributeStartsWith#attributevalue" />
<div class="sample-code">$('<span class="querystring">a[title$="blog"]</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/attributeEndsWith#attributevalue" />
<div class="sample-code">$('<span class="querystring">a[href*="zip"]</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/attributeContains#attributevalue" />
<div class="sample-code">$('<span class="querystring">a[rel][href][title$="blog"]</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/attributeMultiple#attributeFilter1attributeFilter2attributeFilterN" />
</div>
</div>

<div class="example">
<h3>Child Filters</h3>
<div class="content">
<div class="sample-code">$('<span class="querystring">li:nth-child(even)</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/nthChild#index" />
<div class="sample-code">$('<span class="querystring">li:nth-child(odd)</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/nthChild#index" />
<div class="sample-code">$('<span class="querystring">li:nth-child(2)</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/nthChild#index" />
<div class="sample-code">$('<span class="querystring">li:nth-child(2n)</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/nthChild#index" />
<div class="sample-code">$('<span class="querystring">li:first-child</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/firstChild" />
<div class="sample-code">$('<span class="querystring">li:last-child</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/lastChild" />
<div class="sample-code">$('<span class="querystring">code:only-child</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/onlyChild" />
</div>
</div>

<div class="example">
<h3>Forms</h3>
<div class="content">
<div class="sample-code">$('<span class="querystring">:input</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/input" />
<div class="sample-code">$('<span class="querystring">:text</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/text" />
<div class="sample-code">$('<span class="querystring">:password</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/password" />
<div class="sample-code">$('<span class="querystring">:radio</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/radio" />
<div class="sample-code">$('<span class="querystring">:checkbox</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/checkbox" />
<div class="sample-code">$('<span class="querystring">:submit</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/submit" />
<div class="sample-code">$('<span class="querystring">:image</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/image" />
<div class="sample-code">$('<span class="querystring">:reset</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/reset" />
<div class="sample-code">$('<span class="querystring">:button</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/button" />
<div class="sample-code">$('<span class="querystring">:file</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/file" />
<div class="sample-code">$('<span class="querystring">:hidden</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/hidden" />
</div>
</div>

<div class="example">
<h3>Form Filters</h3>
<div class="content">
<div class="sample-code">$('<span class="querystring">input:enabled</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/enabled" />
<div class="sample-code">$('<span class="querystring">:disabled</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/disabled" />
<div class="sample-code">$('<span class="querystring">:checked</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/checked" />
<div class="sample-code">$('<span class="querystring">:selected</span>')</div>
<input type="submit" value="toggle" /><input type="submit" value="documentation" title="http://docs.jquery.com/Selectors/selected" />
</div>
</div>

</div> <!-- end of section -->

</div>

<div id="ad">
<script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=codylindley" id="_carbonads_js"></script>
</div>

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-162561-1', 'auto');
ga('send', 'pageview');

</script>

</body>
</html>

jquery选择器 直观实验的更多相关文章

  1. JavaScript(15)jQuery 选择器

    jQuery 选择器 选择器同意对元素组或单个元素进行操作. jQuery 元素选择器和属性选择器同意通过标签名.属性名或内容对 HTML 元素进行选择. 在 HTML DOM 术语中:选择器同意对 ...

  2. JQuery 选择器

    选择器是JQuery的根基,在JQuery中,对事件的处理,遍历DOM和AJAX操作都依赖于选择器.如果能够熟练地使用选择器,不仅能简化代码,而且还可以事半功倍. JQuery选择器的优势 1.简洁的 ...

  3. jQuery的案例及必知重要的jQuery选择器

    Jquery能做什么 访问和操作DOM元素 控制页面样式 对页面事件进行处理 扩展新的jQuery插件 与Ajax技术完美结合 Jquery的优势 体积小,压缩后只有100KB左右 l强大的选择器 出 ...

  4. 深入学习jQuery选择器系列第一篇——基础选择器和层级选择器

    × 目录 [1]id选择器 [2]元素选择器 [3]类选择器[4]通配选择器[5]群组选择器[6]后代选择器[7]兄弟选择器 前面的话 选择器是jQuery的根基,在jQuery中,对事件处理.遍历D ...

  5. jQuery选择器和选取方法 http://www.cnblogs.com/MaxIE/p/4078869.html

    我们已经使用了带有简单Css选择器的jQuery选取函数:$().现在是时候深入了解jQuery选择器语法,以及一些提取和扩充选中元素集的方法了. 一.jQuery选择器 在CSS3选择器标淮草案定义 ...

  6. 《锋利的jQuery(第2版)》笔记-第2章-jQuery选择器

    选择器是jQuery的根基,在jQuery中,对事件处理.遍历DOM和Ajax操作都依赖于选择器.熟练使用选择器,不仅可以简化代码,而且可以达到事半功倍的效果. 2.1 jQuery选择器是什么 1. ...

  7. 深入学习jQuery选择器系列第八篇——过滤选择器之伪子元素选择器

    × 目录 [1]通用形式 [2]反向形式 [3]首尾元素 [4]唯一元素 前面的话 本文是子元素选择器的续篇,主要介绍关于nth-of-type()选择器的内容.该部分内容并非没有出现在<锋利的 ...

  8. 深入学习jQuery选择器系列第四篇——过滤选择器之属性选择器

    × 目录 [1]简单属性 [2]具体属性 [3]条件属性 前面的话 属性过滤选择器的过滤规则是通过元素的属性来获取相应的元素,对应于CSS中的属性选择器.属性过滤选择器可分为简单属性选择器.具体属性选 ...

  9. 深入学习jQuery选择器系列第二篇——过滤选择器之子元素选择器

    × 目录 [1]通用形式 [2]反向形式 [3]首尾元素 [4]唯一元素 前面的话 在上一篇中已经介绍过基础选择器和层级选择器,本文开始介绍过滤选择器.过滤选择器是jQuery选择器中最为庞大也是最为 ...

随机推荐

  1. koa2学习笔记03 - 给koa2配置session ——koa2结构分层、配置数据库、接口

    前言 这一章写的很没有底气,因为我完全不懂一个正经的后台应用是怎么结构分层的, 所有只能按照我自己的理解去写,即使这样也仅仅只分离出了controller层, 至于所谓的service层,dao层,完 ...

  2. webpack+vuecli使用问题总结

    1,按照官网安装步骤install $ npm install -g vue-cli $ vue init webpack my-project $ cd my-project $ npm insta ...

  3. 【CSU 1803】2016 (数学)

    Description 给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量: 1. 1≤a≤n,1≤b≤m; 2. a×b 是 2016 的倍数. Input 输入包含不超过 30 ...

  4. CentOS7.6离线安装JDK1.8

    卸载CentOS自带的openJDK: 查看openJDK命令:rpm -qa|grep java 结果: java-1.8.0-openjdk-headless-1.8.0.181-7.b13.el ...

  5. 基于 HTML5 Canvas 的机房温度云图展示

    前言 在物联网的大趋势下,机房的设备信息以及一些环境信息变成了数据摆在了人们面前.在这个大数据的时代,数据的可视化不仅体现在数据值本身,更应该通过数据的变化来获取一些信息.我们今天的主题,机房温度云图 ...

  6. tp5 的nginx配置

    下面简单说明一下tp5运行在nginx上的配置. 原文地址:小时刻个人博客>http://small.aiweimeng.top/index.php/archives/tp5_nginx.htm ...

  7. GUN交叉工具链各模块的作用

    名称              归属                             作用 arm-linux-as          binutils     编译ARM 汇编程序  arm ...

  8. 05-基础widgets

    05-基础widgets 介绍 Widget的功能是"描述一个UI元素的配置数据",Widget并不是表示最终绘制在设备屏幕上的显示元素,而只是显示元素的一个配置数据.Flutte ...

  9. SparkStreaming任务保持运行,定时任务监控进程,保证不挂掉

    cron任务:每隔1分钟启动脚本,检查进程是否运行.crontab -e */1 * * * * bash /data/spark/test.sh 检查进程,如果进程挂掉,重新启动Spark任务:给s ...

  10. 验证码生成工具——Jcaptcha

    <dependency> <groupId>com.octo.captcha</groupId> <artifactId>jcaptcha</ar ...