亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何讓操作更多更少分裂?

如何讓操作更多更少分裂?

守候你守候我 2021-07-09 14:00:05
我有一個帶有復選框和按鈕驗證的數據表(matricule、salary、number day 和 premium),我想在單擊按鈕驗證時計算總和值,但有一個錯誤,它為我提供了這個值的 NaN。<table class="table table-bordered" id="mytable">  <tr>    <th><input type="checkbox" id="check_all"></th>    <th>matricule</th>    <th>salary</th>    <th>number day</th>    <th>premium</th>  </tr>  <tr>    <td><input type="checkbox" class="checkbox"></td>    <td>1</td>    <td>5000</td>    <td>2</td>    <td><input type="text" name="prime" class="form-control" value="0"></td>  </tr>  <tr>    <td><input type="checkbox" class="checkbox"></td>    <td>2</td>    <td>6000</td>    <td>2</td>    <td><input type="text" name="prime" class="form-control" value="0"></td>  </tr>  <tr>    <td><input type="checkbox" class="checkbox"></td>    <td>1</td>    <td>7000</td>    <td>1</td>    <td><input type="text" name="prime" class="form-control" value="0"></td>  </tr></table><div class="form-group col-md-offset-5 ">  <button class="btn btn-success add-all" type="submit" id="hide">Pointage men</button></div>用于檢查所有并獲取一些值并計算總和的 jQuery 代碼:$(document).ready(function() {  $('#check_all').on('click', function(e) {    if ($(this).is(':checked', true)) {      $(".checkbox").prop('checked', true);    } else {      $(".checkbox").prop('checked', false);    }  });  $('.checkbox').on('click', function() {    if ($('.checkbox:checked').length == $('.checkbox').length) {      $('#check_all').prop('checked', true);    } else {      $('#check_all').prop('checked', false);    }  });  // jquery code for display array :  $("#hide").click(function() {    var items = [];    $("tr").each(function(i, r) {      if (i > 0 && $(r).find("input").first().prop("checked")) {        //sum = (((salary/24)*nbre)+premium)        let sum = ((($(r.cells[2]).innerText / 24) * $(r.cells[3]).innerText) + $(r.cells[4]).find('input').val());
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 180 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號