JQuery_checkbox_使用小结
来源:互联网 发布:淘宝用户被冻结怎么办 编辑:程序博客网 时间:2024/06/04 18:17
html:
<ul><li style="float:left;margin-right: 25px;"><input style="width:15px;height:15px;float:left;" type="checkbox" name="yq_channnel" value="1" checked="checked"><span style="float:left;display:block;margin-top:2px;">突发事件</span></li><li style="float:left;margin-right: 25px;"><input style="width:15px;height:15px;float:left;" type="checkbox" name="yq_channnel" value="4" checked="checked"><span style="float:left;display:block;margin-top:2px;">防总成员</span></li><li style="float:left;margin-right: 25px;"><input style="width:15px;height:15px;float:left;" type="checkbox" name="yq_channnel" value="3" checked="checked"><span style="float:left;display:block;margin-top:2px;">地方报道</span></li><li style="float:left;margin-right: 25px;"><input style="width:15px;height:15px;float:left;" type="checkbox" name="yq_channnel" value="5"><span style="float:left;display:block;margin-top:2px;">山洪灾害</span></li><li style="float:left;margin-right: 25px;"><input style="width:15px;height:15px;float:left;" type="checkbox" name="yq_channnel" value="7"><span style="float:left;display:block;margin-top:2px;">干旱缺水</span></li><li style="float:left;margin-right: 25px;"><input style="width:15px;height:15px;float:left;" type="checkbox" name="yq_channnel" value="11" checked="checked"><span style="float:left;display:block;margin-top:2px;">论坛信息</span></li><li style="float:left;margin-right: 25px;"><input style="width:15px;height:15px;float:left;" type="checkbox" name="yq_channnel" value="10"><span style="float:left;display:block;margin-top:2px;">世界水旱灾害</span></li><li style="float:left;margin-right: 25px;"><input style="width:15px;height:15px;float:left;" type="checkbox" name="yq_channnel" value="9"><span style="float:left;display:block;margin-top:2px;">台风灾害</span></li><li style="float:left;margin-right: 25px;"><input style="width:15px;height:15px;float:left;" type="checkbox" name="yq_channnel" value="8"><span style="float:left;display:block;margin-top:2px;">工程险情</span></li><li style="float:left;margin-right: 25px;"><input style="width:15px;height:15px;float:left;" type="checkbox" name="yq_channnel" value="6"><span style="float:left;display:block;margin-top:2px;">江河洪水</span></li></ul>
JQuery:
获取checkbox选中的val值:
var typeStr = '';$("input[name^='yq_channnel']").each(function(){if(this.checked){typeStr = typeStr + $(this).val() + ",";}});
给相同name值的checkbox绑定click事件:
$("input[name='yq_channnel']").click(function (){getYuQingInfo();});
给指定value值添加选中状态:
$("input:checkbox[value='"+arr+"']").attr('checked','true');
阅读全文
0 0
- JQuery_checkbox_使用小结
- [小结]svn基本使用小结
- DataGrid分页使用小结
- Ant使用小结
- treeview的使用小结
- TChart使用经验小结
- treeview的使用小结
- UrlReWriter 使用经验小结
- DataGrid分页使用小结
- ThradLocal使用小结
- Hibernate使用小结
- Comparator使用小结
- HashMap 使用小结
- listView使用小结
- 三层架构使用小结
- Typedef 使用小结
- .net使用小结
- Typedef 使用小结
- 实现分布式锁
- 使用RMAN进行数据迁移
- 合并表记录
- linux(十四)之linux NFS服务管理
- ES6入门let与const命令(一)
- JQuery_checkbox_使用小结
- Python基础- pickle 保存数据
- 90个PHP常用接口数据过滤的方法
- servlet之转发与重定向的区别
- 为某个包下的所有实体生成dateSet和xml的国际化文件(xml仅限d7)
- C编程完成倒置第K个元素之后的全部数据元素的算法
- SQL SERVER 2000数据库置疑 紧急模式
- 在shiro中控制自动登录
- openstack irc chat log