假设有一个checkbox页面控件,名叫category,是类目选择,可以多选,但不能不选。
数组方式(如:["311","312"]):
t_category = $('input[name="category[]"]:checked').map(function(index,elem) { return $(elem).val(); }).get();
字符串方式(如:311,312):
t_category = $('input[name="category[]"]:checked').map(function(index,elem) { return $(elem).val(); }).get().join(',');
简化一下:
$("#modal-from-dom input[name='consumeday[]']").map(function(){return $(this).val();}).get();
作者:OK兄 浏览次数:53