我这里有一个动态表格,我需要提醒单击的表格单元格的 colspan 值。我怎样才能使它成为可能
<table>
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<tr>
</thead>
<tbody>
<tr>
<td colspan="2"></td>
<td></td>
<td colspan="3"></td>
</tr>
<tr>
<td></td>
<td colspan="1"></td>
<td></td>
</tr>
</tbody>
</table>
最佳答案
您可以使用:
$('body').on('click','td',function(){
if($(this).hasAttr('colspan'))
alert($(this).attr('colspan'));
});
关于javascript - 如何在点击事件上提醒 colspan 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25500113/