Skip to content

Instantly share code, notes, and snippets.

@kjunichi
Last active December 19, 2015 16:09
Show Gist options
  • Save kjunichi/5982035 to your computer and use it in GitHub Desktop.
Save kjunichi/5982035 to your computer and use it in GitHub Desktop.

jQueryメモ

静的なページなら扱いやすいが、動的なページに対しての操作は途端に難しくなる件。

任意のClassを指定して動的にイベントを取得するには?

$(document).on('click','button.close',function(e){
// 処理
});

動的にタグを追加した場合でも、タブ切り替えのイベントを取得するには?

これが正解なの不明だが、shownではイベントが受け取れなかった。

$(document).on('click', 'a[data-toggle="tab"]', function (e) {
        var tabName = e.target.href;
        var listid = tabName.split("#")[1];
        $('#listid').val(listid);
});

関連リンク

関連Gist

アクセス解析タグ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment