zl程序教程

您现在的位置是:首页 >  前端

当前栏目

jquery get checkbox inside element(td).

jQuery get Element checkbox TD inside
2023-09-27 14:28:06 时间
 1 <td id="skill"><input name="skill" type="checkbox" value="vc">
 2                 vc
 3                 <input name="skill" type="checkbox" value="vb">
 4                 vb
 5                 <input name="skill" type="checkbox" value="vf">
 6                 vf
 7                 <input name="skill" type="checkbox" value="vj">
 8                 vj
 9                 <input name="skill" type="checkbox" value="bc">
10                 bc
11                 <input name="skill" type="checkbox" value="co">
12                 co
13                 <input name="skill" type="checkbox" value="ja">
14                 ja
15                 <input name="skill" type="checkbox" value="delphi">
16                 delphi<span id="skillReport"></span></td>

select all checkboxs:

1  $('#skill input:checkbox').each(function (i) {
2         this.checked = true;
3     });

or simply :

1  $('#skill :checkbox').each(function (i) {
2         this.checked = true;
3     });

 

get checked checkboxs:

$('#skill :checkbox').filter(':checked').each(function (i) {
        alert(this.value);
    });