Using jQuery to get multiple checkbox's value and output as comma separated String.

后端 未结 7 1222
没有蜡笔的小新
没有蜡笔的小新 2020-12-23 17:13

I have many checkboxs as below,

  • Coo
  • 7条回答
    •  甜味超标
      2020-12-23 17:39

      var values = "";
      $("checkbox[name=areaofinterest]").each(function() { 
          values += $(this).val() + ",";
      });
      
      values = values.substring(0, values.length - 2);
      

    提交回复
    热议问题