JS获值

时间:2023-03-10 06:03:50
JS获值
 var json = [];
$('#hdtj table').each(function(index){
json.push({
'con_main':$(this).find('input[name=man]').val(),
'con_reduce_che ck':$(this).find('input[name=check1]').is(':checked'),
'con_give_check':$(this).find('input[name=check2]').is(':checked'),
'is_postage_check':$(this).find('input[name=check3]').is(':checked'),
'con_reduce':$(this).find('input[name=jian]').val(),
'con_give':$(this).find('input[name=song]').val(),
'sel_unit' :$(this).find('select[name=unit]').val(),
})
})
console.log(json);

获取不同表格里面的值

var obj = $('#hdtj table:eq(0)').clone();
$('input[type=text]',obj).val('');
$('input[type=checkbox]',obj).prop('checked',false);
$('#hdtj').append(obj);

克隆  设置