javascript動的生成イベントを返す関数に引数を持たせる
検索すればいっぱい出てくる。
キーワード:イベントハンドラ、スコープ、クロージャー
jQueryで関数Func(x)を返すときは
$('selector").bind('event',function(){Func(x);});
ループの中では
for(var i=0;i<N;i++){
(function(){var x=i;
$('selector"+x).bind('event',function(){Func(x);});
)()};
コメント
javascript動的生成イベントを返す関数に引数を持たせる — コメントはまだありません
HTML tags allowed in your comment: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">