.hasClass() (added in version 1.2) handles this common use case:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
|
You can also use the .is() method along with an appropriate selector for more advanced matching:
1
2
3
4
5
|
|
Note that this method allows you to test for other things as well. For example, you can test whether an element is hidden (by using the custom :hidden selector):
1
2
3
4
5
|
|