在此示例中:在多个函数中使用变量
我想使用在最后一个(第二个)函数的第二个函数中定义的“id”。我认为使用“var”术语就足够了,但它没有。
有谁知道我该怎么做?
jQuery("td.setting").live("click",function(){
text = jQuery(this).text();
var id = jQuery(this).attr("id");
jQuery(this).replaceWith("<td class=\"update\"><input class='inputSetting' type='text' value="+text+"> <img class=\"accept\" alt=\"accept button\" src='images/accept.png'></td>");
console.log(id);
});
jQuery("img.accept").live("click",function(){
jQuery("td.update").replaceWith("<td class=\"setting\"><proc name='C_Settings::getSavedSetting' params='"+id+"'></proc></td>");
});