开发者

jQuery: how to use :checked, if my element is $(this)

how c开发者_C百科an I use the option :checked with $(this) in jQuery ?

i.e. $(this:checked) ?

thanks


$(this).filter(":checked");

or if you're testing it

if ($(this).is(":checked")){
    // ...
}


Like this:

if ($(this).is(':checked'))


Use is() method.

$(this).is(':checked') returns boolean.


The checkbox Node has its own property checked, so:

if (this.checked) ...

there is no need to make jQuery do a bunch of work by packaging that trivially simple check in a selector. The DOM version is perfectly readable.


try it $(':checked', $(this))

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜