jquery随笔--选择器
2013-06-19 09:15
405 查看
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//元素选择器
$("#button1").click(function(){
alert($(this).text());
});
//属性选择器
$("[name=button2]").click(function(){
alert($("#p1").text());
});
$("[name=button3]").click(function(){
//CSS 选择器
$("#p1").css("color","red");
});
});
</script>
</head>
<body>
<h2>This is a heading</h2>
<p id="p1">This is a paragraph.</p>
<button type="button" id="button1">元素选择器</button><br>
<button type="button" name="button2">属性选择器</button><br>
<button type="button" name="button3">CSS 选择器</button>
</body>
</html>
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//元素选择器
$("#button1").click(function(){
alert($(this).text());
});
//属性选择器
$("[name=button2]").click(function(){
alert($("#p1").text());
});
$("[name=button3]").click(function(){
//CSS 选择器
$("#p1").css("color","red");
});
});
</script>
</head>
<body>
<h2>This is a heading</h2>
<p id="p1">This is a paragraph.</p>
<button type="button" id="button1">元素选择器</button><br>
<button type="button" name="button2">属性选择器</button><br>
<button type="button" name="button3">CSS 选择器</button>
</body>
</html>
相关文章推荐
- js随笔,css和js禁止网页选择文本,table的class样式使得td的class样式失效,jquery获得元素坐标
- 页面元素选择二(jQuery学习随笔二)
- js随笔,css和js禁止网页选择文本,table的class样式使得td的class样式失效,jquery获得元素坐标
- ASP.NET jQuery 随笔 从DropDownList获取选择的text和value值
- 页面元素选择一(jQuery学习随笔一)
- 通达OA2015 数据选择控件的使用随笔
- Jquery 选择器,选择多个
- jquery选择器-根据多个属性选择示例代码
- jquery插件开发之实现google+圈子选择功能
- jQuery控制选择框
- 网站中集成jquery.imgareaselect实现图片的本地预览和选择截取
- jQuery第一课 ——属性、节点选择
- jQuery-强大的jQuery选择器 (详解)
- jquery属性选择
- 选择控件:select ,radio,checkbox之用jquery获取选中值的小结
- 手机时间选择插件 Jquery
- JQuery选择
- jQuery table selector jquey 表格 选择器
- Jquery实现弹出选择框选择后返回,支持多级分类
- jquery+Jcrop+servlet图片上传裁剪选择保存实例