jQuery过滤选择器经典应用
本文实例为大家分享了经典的jQuery过滤选择器应用,供大家参考,具体内容如下
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>过滤选择器</title>
<style type="text/css">
#txt_show {display:none; color:#00C;}
#txt_hide {display:block; color:#F30;}
</style>
<script src="js/jquery-1.8.3.js"></script>
<script language="JavaScript">
$(document).ready(function () {
$("[name=show]").click(function () {
$("p:hidden").show();
}) ;
$("[name=hide]").click(function () {
$("p:visible").hide() ;
});
});
</script>
</head>
<body>
<p id="txt_hide">点击按钮,我会被隐藏哦~</p>
<p id="txt_show">隐藏的我,被显示了,嘿嘿^^</p>
<input name="show" type="button" value="点击显示文字" />
<input name="hide" type="button" value="点击隐藏文字" />
</body>
</html>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我们。
相关推荐
-
jQuery子元素过滤选择器用法示例
本文实例讲述了jQuery子元素过滤选择器用法.分享给大家供大家参考,具体如下: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <script src="js/jquery-1.10.1.min.js" type="te
-
jQuery基本过滤选择器用法示例
本文实例讲述了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"> <hea
-
使用jQuery内容过滤选择器选择元素实例讲解
复制代码 代码如下: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!-- 内容过滤选择器:根据元素中的文字内容或所包含的子元素特征获取元素,其文字内容可以模糊或绝对匹配进行元素定位 jQuery选择器详解 根据所获取页面中元素的不同,可以将jQuery选择器分为:基本选择器.层次选择器.过滤选择器.表单选择器四大类.其中,在过滤选择器中有可以分为:简单过滤选择器.内容过滤选择器.可见性过滤选择器.
-
jQuery内容过滤选择器用法示例
本文实例讲述了jQuery内容过滤选择器用法.分享给大家供大家参考,具体如下: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <script src="js/jquery-1.10.1.min.js" type="tex
-
jQuery表单对象属性过滤选择器实例详解
本文实例讲述了jQuery表单对象属性过滤选择器.分享给大家供大家参考,具体如下: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>2-11</title> <script src="jquery-1.7.2.min.js" type="t
-
jquery选择器之层级过滤选择器详解
复制代码 代码如下: $("ancestor descendant"):选取parent元素后所有的child元素$("parent > child"):选取parent元素后所有的直属child元素,何谓"直属",也就是第一级的意思了$("prev + next"):prev和next是两个同级别的元素. 选中在prev元素后面的next元素$("prev ~ siblings"):选择prev后面
-
jquery表单对象属性过滤选择器实例分析
本文实例讲述了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"> &
-
jquery子元素过滤选择器使用示例
复制代码 代码如下: :nth-child('索引值')//获取指定元素下的某个子元素的位置,索引从1开始: //偶数行 //$('li:nth-child(even)').addClass('class1'); //奇数行 //$('li:nth-child(odd)').addClass('class1'); //第一行 //$('li:nth-child(1)').addClass('class1'); //$('li:first-child').addClass('class1'); /
-
jQuery过滤选择器:not()方法使用介绍
jQuery(':not(selector)') 在jQuery的早期版本中,:not()筛选器只支持简单的选择器,说明我们传入到:not这个filter中的selector可以任意复杂,比如:not(div a) and :not(div,a) 复制代码 代码如下: <p >"a">sdfsdfs</p> <p >"b">sdfsdfs</p> <p >"c">sdf
-
jQuery可见性过滤选择器用法示例
本文实例讲述了jQuery可见性过滤选择器用法.分享给大家供大家参考,具体如下: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <!-- 引入jQuery --> <script src="js/jquery-1.10.1.mi
-
jQuery过滤选择器用法示例
本文实例讲述了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&
随机推荐
- Windows下安装Redis及使用Python操作Redis的方法
- 让新消息在网页标题闪烁提示的jQuery代码
- 关于使用axios的一些心得技巧分享
- js导入导出excel(实例代码)
- 使用Eclipse开发工具如何解决Java Compiler中Annotation Processin不出现的问题
- 详解iOS应用开发中的ARC内存管理方式
- 使用C#处理WebBrowser控件在不同域名中的跨域问题
- 基于jquery的鼠标拖动效果代码
- PHP计算一年多少个星期和每周的开始和结束日期
- PHP CodeIgniter框架的工作原理研究
- 坏狼的PHP学习教程之第1天
- Spring AOP代理详细介绍
- Android中AsyncTask的用法实例分享
- Android自定义TitleView标题开发实例
- bootstrap实现动态进度条效果
- jquery插件jTimer(jquery定时器)使用方法
- Python下使用Psyco模块优化运行速度
- JS Attribute属性操作详解
- Java的Spring框架中DAO数据访问对象的使用示例
- Android中刷新界面的二种方法
