jquery选择器
来源:互联网 发布:淘宝v5会员消费多少钱 编辑:程序博客网 时间:2024/06/06 19:57
<html>
<head>
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript">
$(function(){
//用于搜索的,通过元素的 id 属性中给定的值
//alert($("#a").text());
//根据给定的元素名匹配所有元素
//alert($("p").text());
//查找所有类是 "myClass" 的元素
//alert($(".a").text());
//selector1,selector2,selectorN
//alert($(".a,.d").text());
//alert($("div p").text());
//匹配所有紧接在 prev 元素后的 next 元素 prev + next
//alert($("div+p").text());
//匹配给定的属性是某个特定值的元素
$("input[name='cccc']").val("iiiiii");
//匹配所有type为button的元素
$(":button").val("pppp");
});
</script>
</head>
<body>
<button id="run">Run</button><div></div>
<div>
<span id="a">span</span>
<p id="a" class="a">aaa</p>
</div>
<div>
<p id="f" class="f">fff</p>
</div>
<p id="b" class="a">bbb</p>
<Form id="myForm">
2131
<input type="text" name="cccc" value="cccc"/>
<input type="button" value="dddd"/>
<p class="d" >dddd</p>
</Form>
</body>
</html>
<head>
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript">
$(function(){
//用于搜索的,通过元素的 id 属性中给定的值
//alert($("#a").text());
//根据给定的元素名匹配所有元素
//alert($("p").text());
//查找所有类是 "myClass" 的元素
//alert($(".a").text());
//selector1,selector2,selectorN
//alert($(".a,.d").text());
//alert($("div p").text());
//匹配所有紧接在 prev 元素后的 next 元素 prev + next
//alert($("div+p").text());
//匹配给定的属性是某个特定值的元素
$("input[name='cccc']").val("iiiiii");
//匹配所有type为button的元素
$(":button").val("pppp");
});
</script>
</head>
<body>
<button id="run">Run</button><div></div>
<div>
<span id="a">span</span>
<p id="a" class="a">aaa</p>
</div>
<div>
<p id="f" class="f">fff</p>
</div>
<p id="b" class="a">bbb</p>
<Form id="myForm">
2131
<input type="text" name="cccc" value="cccc"/>
<input type="button" value="dddd"/>
<p class="d" >dddd</p>
</Form>
</body>
</html>
- CSS选择器,jQuery选择器
- jQuery选择器 CSS选择器
- JQuery选择器(选择器简介)
- jQuery选择器 基本选择器
- jQuery选择器 层次选择器
- jQuery选择器 表单选择器
- Jquery选择器-基本选择器
- jQuery选择器之类选择器
- jQuery选择器之类选择器
- jQuery选择器之类选择器
- Jquery选择器--过滤选择器
- JQuery选择器
- jquery 选择器
- Jquery选择器
- jQuery选择器
- jQuery 选择器
- JQuery选择器
- JQuery选择器
- Hibernate 保存带有时分秒的Oracle 数据库日期类型
- 用于自定义数组/结构体数组的剪切板应用模板类
- ant 解压
- 靠资本运行的人人缺乏产品基因
- 经典整理之_理解Fragment生命周期
- jquery选择器
- S5PV210 FIMC驱动和v4l2驱动框架学习
- 【转】国家集训队论文分类整理
- Unity3D仿电影字幕
- 【discuzX2】/source/function/function_forum.php论坛模块通用函数集合分析
- 【Cocos2d-X开发学习笔记】第16期:动作类之缓冲动作和组合动作的使用
- 使用PHP读取远程文件的四种方法
- 在android init.xxx.rc中启动shell脚本
- 如何在有http代理的局域网内建立ubuntu源镜像