今天做了一个有关checkbox点击的项目,点击checkbox获取这行的数值,然后相加。运用的是jquery和PHP传值。

循环遍历checkbox按钮,和点击后提示。

 $('input[type=checkbox]').click(function () {
            var num=0;
            $("input:checked").parent("div").siblings('div[name=weight]').each(function () {
                console.log(parseInt($(this).text()));
                num+=parseInt($(this).text());
            });
            if(num>={$matching[0]['car_weight']})
            {
                alert("请不要超出车辆载重重量");
                return false;
            }
        });

 

相关文章:

  • 2022-12-23
  • 2021-09-30
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
  • 2022-12-23
  • 2022-12-23
  • 2022-01-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
  • 2021-10-17
  • 2022-02-13
相关资源
相似解决方案