C# 为 form 窗体中的所有相同组件循环添加相同事件,这样减少了代码量. private void Form2_Load(object sender, EventArgs e) { foreach (Control c in groupBox1.Controls)//遍历groupBox1内的所有控件 { if (c is CheckBox)//只遍历CheckBox控件 { ((CheckBox)c).CheckStateChanged += new EventHandler(chk_Ch
项目中用的jquery-1.11 今天需要检测一个checkbox的选中状态,想当然的用 .attr("checked") ,结果发现,无论是否选中,这个值都是 undefined 未定义. 折腾了半天,发现:As of jQuery 1.6, the .attr() method returns undefined for attributes that have not been set. In addition, .attr() should not be used on pla