我需要从所有选中复选框的 HTML 表中获取选中值
$('#table').input[checkbox].checked.getall();
Run Code Online (Sandbox Code Playgroud)
我需要这样的东西???
在 Jquery 中使用:checked。检索所有值意味着在 jquery 中使用每个值
var selected = new Array();
$('#table input[type="checkbox"]:checked').each(function() {
selected.push($(this).attr('id'));
});
console.log(selected);
Run Code Online (Sandbox Code Playgroud)
或 jquery 中的 map()
$("#table input[type=checkbox]:checked").map(function() {
return this.id;
}).get();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18137 次 |
| 最近记录: |