Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know the type of an object is checkbox in jquery?

Tags:

jquery

How to detect type of object is 'checkbox' or something else.

like image 681
Talha Avatar asked Jan 27 '26 08:01

Talha


2 Answers

You can use is method:

if ($(this).is(":checkbox")) {
    // is checkbox
} else {
    // not checkbox
}
like image 153
VisioN Avatar answered Jan 28 '26 21:01

VisioN


$(element).attr('type') == 'checkbox'
like image 41
davids Avatar answered Jan 28 '26 21:01

davids