« FCKeditorモジュールを翻訳 | Main | Drupalでモジュールからjavascriptに値を渡す »

jQueryで特定のエレメントが存在するか判定する

jQueryを使っていて、特定のエレメントが存在している場合にだけ行いたい処理があったりします。
そういった場合に、そのエレメントが存在しているかどうか判定する方法を自分用にメモ。

if ($("body").is(":has('エレメントを特定するセレクタ')")) {
 ...行う処理...
}

|

« FCKeditorモジュールを翻訳 | Main | Drupalでモジュールからjavascriptに値を渡す »

パソコン・インターネット」カテゴリの記事

Comments

Post a comment



(Not displayed with comment.)




TrackBack

TrackBack URL for this entry:
http://app.cocolog-nifty.com/t/trackback/24638/42238718

Listed below are links to weblogs that reference jQueryで特定のエレメントが存在するか判定する:

« FCKeditorモジュールを翻訳 | Main | Drupalでモジュールからjavascriptに値を渡す »