Jquery-选择框点击勾选或者取消
1:单选框,直接定位到属性名称
$(document).ready(function(){ var old = null; //用来保存原来的对象 $("input[name='sex']").each(function(){//循环绑定事件 if(this.checked){ this.checked= false; }else{ this.checked = true; } }); });
2.根据iD
function select_input(hid){ jQuery("#"+hid).each(function(){//循环绑定事件 if(this.checked){ this.checked = false; }else{ this.checked = true; } }); }
知识只有共享才能传播,才能推崇出新的知识,才能学到更多,这里写的每一篇文字/博客,基本都是从网上查询了一下资料然后记录下来,也有些是原滋原味搬了过来,也有时加了一些自己的想法