質問

I would like to check whether the particular sytle / class has already been applied on given element.

What is the correct jQuery function to check this?

役に立ちましたか?

解決

Use .hasClass()

The Syntax is

$(selector).hasClass(classname)

他のヒント

Just use hasClass();

$('#mydiv').hasClass('testClass');

ie...

  if($('#mydiv').hasClass('testClass')){  //YOUR CODE HERE if TRUE }
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top