简体   繁体   中英

Value for each checkbox in jQuery

I would like to know how I can set values for each checkboxs. For example: I have 2 checkboxes, and their values will be:

Checkbox One: 1
Checkbox two: 16

If I select Checkbox One + Two I'll update my input value for: 17. But If I uncheck checkbox two, the value will update to 1 and vice-versa.

I made this, months ago...But I lot when I format my computer, I already do something like in C#, but i need to do the same in Web.

I don't want a full source-code, I just want tips that how I can handle this.

只需将每个复选框的value属性设置为所需的值,使用jquery选择器获取所有选中的复选框,并使用$ .each总计选中的值。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM