表单怎么可能只提交clickt表格单元格的“输入”字段
<form id="switch" method="POST">
<table>
<tr>
<td>some content<input type="hidden" name="switch_value" value="1"></td>
<td>some content<input type="hidden" name="switch_value" value="2"></td>
<td>some content<input type="hidden" name="switch_value" value="3"></td>
<td>some content<input type="hidden" name="switch_value" value="4"></td>
<td>some content<input type="hidden" name="switch_value" value="5"></td>
</tr>
</table>
</form>
试试这个:
<form id="switch" method="POST">
<table>
<tr>
<td><label>some content<input type="radio" name="switch_value" value="1"></label></td>
<td><label>some content<input type="radio" name="switch_value" value="2"></label></td>
<td><label>some content<input type="radio" name="switch_value" value="3"></label></td>
<td><label>some content<input type="radio" name="switch_value" value="4"></label></td>
<td><label>some content<input type="radio" name="switch_value" value="5"></label></td>
</tr>
</table>
</form>
<script>
$(document).ready(function(){
$('#switch input[type="radio"]').change(function(){
$('#switch').submit();
});
});
</script>
我以label
这种方式包装了文本和单选按钮,即使您使用css隐藏radio buttons
,文本也会将事件传播到单选按钮。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句