开发者

what's syntax for uncheck the checkbox for in specific row?

I'm new to JQuery, i want to uncheck certain row in the repeater grid.

I got this work, this will uncheck all checkbox for me.

$('span.chkIncRows input').attr('checked', false);     

This works for me, if I want to uncheck row #2 checkbox from the repeater, without passing row number.

$('span.chkIncRows input')[2].checked开发者_如何学运维 =false;           

I don't know the syntax to uncheck the checkbox, if i want to pass in the row number into checkbox.

For example: I really want to do something like this, but it doesn't work.

$('span.chkIncRows input')[rowNumber].checked =false;  

Thanks advance for your help. Annie


Use the :eq selector:

$('span.chkIncRows input:eq(1)').attr('checked', true);  

Note that it's zero-based, so input:eq(1) selects the second input.


Try:

$('span.chkIncRows input').eq(2).attr('checked', false);

It's hard to say without knowing exactly what your HTML looks like. [edit] Also check @SLaks' answer; it depends on the context for the operation. The selector (':eq()') is handy but it means you have to glue the string together (which admittedly is not difficult).


Use the eq selector: http://api.jquery.com/eq-selector/

$('span.chkIncRows input:eq(1)').attr('checked', false);

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜