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

how can i use the parameter: marked with $ (this) in jQuery?

i.e. $ (this: checked)?

thank

+3
source share
5 answers
$(this).filter(":checked");

or if you are testing it

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

Like this:

if ($(this).is(':checked'))
+1
source

Use the is () method.

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

+1
source

The Node flag has its own property checked, therefore:

if (this.checked) ...

There is no need to do jQuery to do a bunch of work, packing this trivially simple check in a selector. The DOM version is well readable.

+1
source

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

0
source

Source: https://habr.com/ru/post/1742997/


All Articles