構文
- 準備完了イベントの省略形roosteronacid より
- 改行と連鎖可能性roosteronacid より
- フィルターのネストネイサン・ロング
- コレクションをキャッシュし、同じ行でコマンドを実行するroosteronacid より
- セレクターを含むroosteronacid より
- 要素作成時のプロパティの定義roosteronacid より
- 配列と同じようにjQuery関数にアクセスするroosteronacid より
- noConflict関数 - $変数を解放するオリ
- noConflictモードで$変数を分離するニックフ
- 非競合モードroosteronacid より
データストレージ
- データ関数 - 要素にデータをバインドするTenebrousX による
- HTML5 データ属性のサポートが強化されました!roosteronacid より
- jQueryメタデータプラグインフィリップ・デュパノヴィッチ
最適化
- 複雑なセレクタのパフォーマンスを最適化するroosteronacid より
- コンテキストパラメータlupefiasco による
- 検索を保存して再利用するネイサン・ロング
- HTML 要素を作成して参照を保持する、要素が存在するかどうかを確認する、独自のセレクターを作成するアンドレアス・グレッチ
その他
- コレクション内の要素のインデックスを確認するレッドスクエアより
- ライブイベントハンドラーTMによる
- 匿名関数を名前付き関数に置き換えるケン
- Microsoft AJAX フレームワークと jQuery ブリッジスレイス著
- jQuery チュートリアルegyamado より
- コレクションから要素を削除し、連鎖可能性を維持するroosteronacid より
- 匿名関数の先頭で$thisを宣言するベン
- FireBug lite、Hotboxプラグイン、画像が読み込まれたことを通知、Google CDNカラーブレンド
- サードパーティのjQueryスクリプトの賢明な使用作成者: harriyott
- 各機能ヤン・ジック
- フォーム拡張プラグインクリス・S
- 各関数を非同期にするOneNerd より
- jQuery テンプレート プラグイン: レンダリング関数を使用して複雑なロジックを実装するroosteronacid より
ベストアンサー1
HTML要素を作成し参照を保持する
var newDiv = $("<div />");
newDiv.attr("id", "myNewDiv").appendTo("body");
/* Now whenever I want to append the new div I created,
I can just reference it from the "newDiv" variable */
要素が存在するかどうかを確認する
if ($("#someDiv").length)
{
// It exists...
}
独自のセレクターを作成する
$.extend($.expr[":"], {
over100pixels: function (e)
{
return $(e).height() > 100;
}
});
$(".box:over100pixels").click(function ()
{
alert("The element you clicked is over 100 pixels height");
});