JQuery 多属性选择节点
2016-05-19 20:34
573 查看
JQuery 1.6.0+以后用prop()代替attr();
多属性选择节点
多属性选择节点
$("input[type=checkbox][name='first2'][value='first4']")。
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <script type="text/javascript" src="js/jquery-2.2.3.js"></script> <script type="text/javascript"> <!-- //--> function first(){ var checked = $("input[type=checkbox][name='first2'][value='first4']").prop("checked"); if(checked == true){ $("input[type=checkbox][name='first2'][value='first4']").prop("checked", false); }else{ $("input[type=checkbox][name='first2'][value='first4']").prop("checked", true); } } </script> </head> <body> <input type="checkbox" id="first1" name="first2" title="first3" value="first4"/> <input type="button" id="button" onclick="first()" value="提交"/> </body> </html>
相关文章推荐
- js实现windows扫雷(jquery)
- jquery滑动
- jQuery入门(3) 设置DOM属性与获取DOM属性
- Jquery 对象和Dom对象(js) 的异同点
- jQuery入门(2) 获取元素和DOM转换
- jQuery同时操作多个属性
- jquery效果-淡入与淡出效果
- jQuery 获取屏幕高度、宽度
- jquery移除事件
- jquery操作select(取值,设置选中)
- WebStrom 2016.1.1.破解
- jQuery入门(1) 加载事件
- jquery修改css的两种方法
- jquery的height()和javascript的height总结,js获取屏幕高度
- jquery width,innerWidth,outterWidth 及事件操作
- jQuery.html() .text()和.val() 的用法
- Jquery可移动的DIV
- JQuery为textarea添加maxlength属性并且兼容IE
- 用jQuery获取table中行id和td值的实现代码
- jQuery scrollFix滚动定位插件