Skip to content

Instantly share code, notes, and snippets.

@inakagawa
Last active November 17, 2015 05:47
Show Gist options
  • Save inakagawa/bd9603b14faecb7df001 to your computer and use it in GitHub Desktop.
Save inakagawa/bd9603b14faecb7df001 to your computer and use it in GitHub Desktop.
jqcb 読書メモ

jQuery Cookbook 読書メモ

ブラウザから書くと、日本語が自由ではないので、local repo に clone して書くしかない。

chapter 1

jQueryの基本、こんなことができる

基本

セレクタ、チェーン

jQuery('div').hide().text('new content').addClass('updatedContent').show();

ラッパーセット(選択中の複数要素に適用される)

「なにができるか」= jQuery API の章立てをみてみよう

step-by-step chapter 1

1.2) ページ読み込みのタイミング(p11)

jQuery(document).ready(f(){...});
// jQuery(f(){...});

1.3) セレクタ+jQuery で DOM を選択

jQuery('selector1, selector2').length

文字列のかわりにDOMオブジェクト参照も渡せる

jQuery(document.getElementsById('a')).length

notes

  • ready と window.onload
    • window.onload != $(document).ready
    • $().ready: DOMツリーが構築された直後 外部リソースを待たない
  • jsやcssを書く位置
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment