Last modified date : 2019/01/31

使い方

$("foo").notClasses(classes);

fooには、複数のclassが設定されていないか調べたい要素のセレクタを指定します。

引数

classes

classesには、次のいずれかの書き方で調べたいclassを設定します。

// 半角スペース区切りの文字列  
$("foo").notClasses("foo bar");
// CSSのセレクタのようなドットでつなぐ文字列  
$("foo").notClasses(".foo.bar");
// 配列  
$("foo").notClasses(["foo","bar"]);

サンプル

user.jsに以下の様に記述すると、フォーカスしたtextareaにfullとhighというclassが指定されていない場合、textareaの高さが200pxに伸びます。

$("textarea").focus(function(){
  if ($(this).notClasses("full high")) {
    $(this).height(200);
  }
});