码迷,mamicode.com
首页 > 其他好文 > 详细

循环repeater中的textbox,相加

时间:2015-01-12 17:21:22      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:

循环repeater中textbox的值,并相加 

    var num = 0;

              function txt_change() {

                  $.each($("input:text[id*=‘txtgs‘]"), function (index, item) {

                       $(item).bind("keyup", function () {

                         $.each($("input:text[id*=‘txtgs‘]"), function (index, item) {

                             if ($.trim($(item).val()) != "") {

                                  if (!isNaN($.trim($(item).val()))) {

                                      num += parseInt($(item).val());

                                  } else {

                                      alert("请输入数字");

                             }

                           });

                       $("#lab_count").text(num);

                       });

                  });

 

                   $("#lbltotal").each(function () {

                       alert($("#lbltotal").length);

                  })

           }

 

循环repeater中的textbox,相加

标签:

原文地址:http://www.cnblogs.com/hcf-0320/p/4218642.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!