input多选计算
CSS代码:
body {
counter-reset: icecream;
}
input:checked {
counter-increment: icecream;
}
.total::after {
content: counter(icecream);
}
HTML代码:
<strong>下面中国十大冰淇淋你吃过几个?</strong>
<ol>
<li><input type="checkbox" id="icecream1"><label for="icecream1">哈根达斯</label></li>
<li><input type="checkbox" id="icecream2"><label for="icecream2">和路雪wall's</label></li>
<li><input type="checkbox" id="icecream3"><label for="icecream3">八喜冰淇淋</label></li>
<li><input type="checkbox" id="icecream4"><label for="icecream4">DQ冰淇淋</label></li>
<li><input type="checkbox" id="icecream5"><label for="icecream5">蒙牛冰淇淋</label></li>
<li><input type="checkbox" id="icecream6"><label for="icecream6">雀巢冰淇淋</label></li>
<li><input type="checkbox" id="icecream7"><label for="icecream7">伊利冰淇淋</label></li>
<li><input type="checkbox" id="icecream8"><label for="icecream8">乐可可冰淇淋</label></li>
<li><input type="checkbox" id="icecream9"><label for="icecream9">新城市冰淇淋</label></li>
<li><input type="checkbox" id="icecream10"><label for="icecream10">明治MEIJI</label></li>
</ol>
你总共选择了 <strong class="total"></strong> 款冰淇淋!

input多选计算的更多相关文章
- input全选与单选(把相应的value放入隐藏域去)
框架是Jquery 需求是: 页面上有很多复选框,1.当我选择一项复选框时候 把对应的值放入到隐藏域去 2.当我反选的时候 把隐藏域对应的值删掉.3.当我全选的时候 页面上所有的选择框的值一起放到隐藏 ...
- jquery 无刷新添加/删除 input行 实时计算购物车价格
jquery 无刷新添加/删除 input行 实时计算购物车价格 jquery 未来事件插件jq_Live_Extension.js 演示 <script> $(document).rea ...
- 页内多个input全选不干扰且只用一段代码。
//html内容 <body> <div id="d1"> <input type="checkbox" class=" ...
- 关于input全选反选恶心的异常情况
上一篇讲到:第一次点击全选按钮input显示对勾,第二次则不显示,需要用prop来添加checked属性. 但是用prop会出现一个问题,对勾显示,而checked属性不会被添加(比如:$(" ...
- input复选框操作的部分高频率使用代码
1. 获取单个checkbox选中项(三种写法): $("input:checkbox:checked").val() 或者 $("input:[type='checkb ...
- input全选和取消全选
<!DOCTYPE html><html> <head> <meta charset="utf-8" /> <title> ...
- jQuery获取input复选框的值
var ipResolveValue =[]; //定义一个空数组$("input[name='ipResolve']:checked").each(function(){ / ...
- js input复选框选中父级同时子级也选中
js实现复选框选中父级元素子级元素也选中,没有子级元素选中父级也不选中的效果 HTML <tr> <td> <label> <input name=" ...
- input 全选 jquery封装方法
HTML代码 <table class="table table-striped"> <thead> <tr> <th><in ...
随机推荐
- python实现Linux启动守护进程
python实现Linux启动守护进程 DaemonClass.py代码: #/usr/bin/env python # -*- coding: utf-8 -*- import sys import ...
- JQuery------$.getJSON()方法的使用
html(../Home/Index.cshtml) <body> <button class="Btn">按钮</button> </b ...
- electron打包
1.全局安装electron-packager npm install -g electron-packager 2.在项目目录下执行命令 electron-packager ./ --platfor ...
- linux下VNC的配置及使用
我们知道在windows里面有远程桌面(著名的有pcanywhere,网络人等)对吧,在linux下我们同样有这个东西,其中最流行的一种就是VNC,其实VNC是一种协议,它的全称是virtual ne ...
- C#--副线程调用主线程的控件
1.取消线程安全保护模式 在程序初始化的时候对要操作的控件设置下面的属性: System.Windows.Forms.Control.CheckForIllegalCrossThrea ...
- Java Native Interface Specification
http://docs.oracle.com/javase/6/docs/technotes/guides/jni/spec/jniTOC.html http://www.ibm.com/develo ...
- 国内GIT托管服务
http://www.cnblogs.com/TianFang/p/3348949.html
- C# unmanaged function pointers for iOS
C# unmanaged function pointers for iOS Just a reminder to myself when I need this thing next time fo ...
- ERROR 1130 (HY000) Host ‘hostname’ is not allowed to connect to this MySQL server
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; FLUSH PRIVILEGES;
- Effective Objective-C 2.0 — 第10条:在既有类中使用关联对象存放自定义数据
可以通过“关联对象”机制来把两个对象连起来 定义关联对象时可指定内存管理语义,用以模仿定义属性时所采用的“拥有关系”与“非拥有关系” 只有在其他做法不可行时才应选用关联对象,因为这种做法通常会引入难于 ...
