当单击同一表格内的超链接时,我需要禁用表格单元格内的所有复选框。
我使用以下 jquery 代码来选择嵌套在表格内的所有复选框。
$el = $(this).parents('table:eq(0)')[0].children('input[type="checkbox"]');
$($el).attr('checked', true);
由于某种原因,这段代码无法工作。
谁能告诉我如何修复它?
最佳答案
$('table input[type=checkbox]').attr('disabled','true');
如果您有表格的 ID
$('table#ID input[type=checkbox]').attr('disabled','true');
关于jquery - 使用 jquery 禁用表内的所有复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1426419/