danlis

JS 中for循环的话则是按照程序写法,break和continue的使用。

JS each:

break 对应的是 return false

continue 对应的是 return true

这个问题每次都会记不清,都要去查一遍百度再确定答案,在这里也记一遍好了。

 

function getProAccessory() {
                $("#proaccessory").val("");
                var arr = new Array();
                $("label[accessid]").each(function () {
                    var id = $(this).attr("accessid");
                    if (id == "" || id == null) {
                        return true;
                    }
                    arr.push({ ProductAccessoryID: id });
                });
                console.log("accessory arr的值" + arr);
                $("#proaccessory").val(JSON.stringify(eval(arr)));
                console.log("json后的值" + $("#proaccessory").val());
            }

 

分类:

技术点:

相关文章:

  • 2021-10-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2021-08-28
猜你喜欢
  • 2021-11-23
  • 2021-11-23
  • 2021-08-31
  • 2021-12-02
  • 2022-02-14
  • 2021-11-23
相关资源
相似解决方案