The following editor will bring you an example of jQuery realizing that only one of the two columns of CheckBox in the table can be selected. The editor thinks it’s pretty good, so I’ll share it with everyone in the jquery source code now, and give it as a reference for everyone. If you are interested in jquery, please follow the editor to have a look
//html
<table id="unit"> <tr> <th>选项一</th> <th>选项二</th> <th>姓名</th> </tr> <tr> <td><input type="checkbox" /></td> <td><input type="checkbox" /></td> <td>小红</td> </tr> <tr> <td><input type="checkbox" /></td> <td><input type="checkbox" /></td> <td>小明</td> </tr> </table>
//jQuery
<script type="text/javascript"> $(function(){ $("#unit tr").click(function () { $(this).siblings().find("input[type='checkbox']").removeAttr("checked"); }); }) </script>
//Renderings, temporarilycannot be uploadeddynamic ones, personal testing is useful
The above is the entire content of the jQuery implementation example where only one of the two column CheckBoxes in the table can be selected by the editor. I hope you like it. Oh~
Related recommendations:
detailed explanation of jQuery Ajax method for uploading files
jQuerylayui common method examples sharing
Introduction to common methods of jQuery layui
The above is the detailed content of jQuery implements an example of how only one of two column CheckBoxes in a table can be selected. For more information, please follow other related articles on the PHP Chinese website!