js this获取元素ID
<table id="cyyj_table" class="table01" cellpadding="5" cellspacing="1"> <tbody id="tb"> <#list li as li> <tr id='${li.id}'> <td width="80%"> <input id ='${li.id}' class="customold" style="width:85%" value='${li.custom}'/> </td> <td align="center"> <input class="ordold" style="width:52px" type="number" value='${li.ord}'/> </td> <td align="center"> <a class="zxui-linkbutton" onclick="detCus('${li.id}');">删除</a> </td> </tr> </#list> </tbody> </table>
js获取table两个input空间的值以及其id。
$(".customold").each(function(){ var customold = $(this).val(); var obj = $(this); var customoldid = $(obj).attr('id'); customolds+=customold+','; customoldids+=customoldid+','; });