jQuery选择器 标签选择元素+css简单添加移除操作
2017-07-26 20:52
816 查看
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jQuery选择器</title> <!--jQuery选择器类似于CSS选择器 具体规则见:http://jquery.cuishifeng.cn/--> <style> img{ border: 1px solid gray; width: 200px; height: 200px; margin: 10px; } .a{ border: 3px dotted green; } </style> <script src="../../../js/jquery-3.1.1.min.js"></script> <script> $(function(){ //选择元素,添加事件 直接在$后面的('')中输入要操作的元素 $('img').mouseover(function(){//当鼠标悬浮时 为img添加a类 //$(this).css('border','5px solid red'); $(this).addClass('a'); }).mouseout(function(){//当鼠标移开时删除a类 //$(this).css('border','10px solid orange'); $(this).removeClass('a') }) }) </script> </head> <body> <img src="../../../img/01.jpg" alt=""/> <img src="../../../img/02.jpg" alt=""/> <img src="../../../img/03.jpg" alt=""/> </body> </html>
相关文章推荐
- 1.jQuery基础语法 2.jQuery选择器、操作页面文档元素 3.jqueryDOM操作 4.jqueryCSS操作 5.Jquery事件 6.Jquery动画
- 1.jQuery基础语法 2.jQuery选择器、操作页面文档元素 3.jqueryDOM操作 4.jqueryCSS操作 5.Jquery事件 6.Jquery动画
- jquery之选择将被操作的元素(利用自定义jquery选择器)
- jQuery1.9为动态添加元素绑定事件以及获取和操作checkbox的选择属性11
- 使用选择器语法来查找元素 - 你想使用类似于CSS或jQuery的语法来查找和操作元素
- JQuery快速添加/移除插件EasyInsert的简单取值、自动添加或移除多行标签、自动添加事件
- dom4j-2.1基础 addElement 添加操作-在最后一个指定复杂元素中添加一个简单元素
- VC2005:无法执行添加/移除操作,因为代码元素DlgXXX是只读的 .
- 无法执行添加/移除操作,因为代码元素**是只读的
- 无法执行添加/移除操作,因为代码元素**是只读的
- 使用jQuery内容过滤选择器选择元素实例讲解
- jQuery参考实例 1.3 使用选择器和jQuery函数对DOM元素进行选择
- JQuery 绑定select标签的onchange事件,弹出选择的值,并实现跳转、传参(selected的值和页面其它元素的值)
- jquery内容选择器(匹配包含指定选择器的元素)
- jQuery来了--进行CSS操作的方法(添加/删除类),CSS()方法
- jQuery1.9为动态添加元素绑定事件以及获取和操作checkbox的选择属性
- 10014---jQuery--jQuery DOM 操作-添加元素
- vs2008无法执行添加/移除操作,因为代码元素**是只读的
- 无法执行添加/移除操作,因为代码元素 是只读的
- jquery学习 - jquery选择孩子元素和个数/获取css属性