zoukankan      html  css  js  c++  java
  • 循环repeater中的textbox,相加

    循环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);

                      })

               }

  • 相关阅读:
    js 数组去重的几种方式及原理
    js replace
    gulp的使用方法
    gulp 安装部署
    gulp 的5个方法
    fiddler 监听手机的http请求
    vsCood
    browser-sync使用方法
    browser-sync 安装
    npm 移除第三方包
  • 原文地址:https://www.cnblogs.com/hcf-0320/p/4218642.html
Copyright © 2011-2022 走看看