- <!doctype html>
-
- <html lang="en">
-
- <head>
-
- <meta charset="utf-8">
-
- <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
- <script>
- $(document).ready(function () {
- var sum = 0;
-
-
- $("input[type=checkbox]").change(function () {
- recalculateCheck();
- });
-
- function recalculateCheck() {
- var sum = 0;
- $("input[type=checkbox]:checked").each(function () {
- sum += parseInt($(this).val());
- });
- $('#total').val(sum);
- }
- });
- </script>
- </head>
-
- <body>
-
-
- <input type="text" id="total" value="">
-
- <input type="checkbox" id="1" value="10" name="1" />
- <input type="checkbox" id="2" value="20" name="1" />
- <input type="checkbox" id="3" value="30" name="1" />
Indlæg senest redigeret d. 21.04.2014 21:08 af Bruger #955