html获取选中复选框的值,获取html复选框列表选中的值隐藏字段
如何獲取選中的復(fù)選框id到一個隱藏的變量?獲取html復(fù)選框列表選中的值隱藏字段
我收到此錯誤。
SyntaxError: unterminated string literal
var test = $('input[name=\'data-grid_c0[]\').val();
數(shù)據(jù)grid_c0是復(fù)選框陣列的名稱。
下面是我寫的jQuery代碼。
$('#deleteall-button').click(function() {
var atLeastOneIsChecked = $('input[name=\"data-grid_c0[]\"]:checked').length > 0;
var test = $('input[name=\'data-grid_c0[]\').val();
alert(test);
if (!atLeastOneIsChecked)
{
alert('Please select atleast one record to delete');
}
else if (window.confirm('Are you sure you want to delete the records?'))
{
document.getElementById('search-form').action = 'index.php?r=device/bulkDelete';
document.getElementById('search-form').submit();
}
});
我想數(shù)據(jù)grid_c0的價值被分配到selectedDevices隱藏字段。
Bulk Delete,使用PHP,我將能夠處理它如下,并刪除,
//check-boxes
if (isset($_POST['selectedDevices'])) { //data-grid_c0
$del_camps = $_POST['selectedDevices']; //data-grid_c0
$model_camp = new Device;
foreach ($del_camps as $_camp_id) {
$model_camp->deleteByPk($_camp_id);
}
}
2014-10-10
dev1234
+0
你為什么不只是張貼自己他們將得到公布為CSV反正復(fù)選框 –
2014-10-10 06:39:11
總結(jié)
以上是生活随笔為你收集整理的html获取选中复选框的值,获取html复选框列表选中的值隐藏字段的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql定时任务每天凌晨删除一周前数据
- 下一篇: layui批量获取复选框的值