私はデータテーブルを使用しており、行を編集するために現在の行に入力要素を挿入できます。入力要素にキーを押して入力するように設定したいのですが、jquery によって挿入された絶対値では機能しません。
jquery:
$("#showCategories tbody").dblclick(function(event) {
var nTds_showCategories = $('td', this);
$(oTable_categories.fnSettings().aoData).each(function (){$(this.nTr).removeClass('row_selected');});
$(event.target.parentNode).addClass('row_selected');
current_category_text=$.trim( $(event.target).text() );
current_category_path=$(event.target);
$(event.target).html("<input value= '"+ $(event.target).text() +"' style='width:200px;float:right;height:17px;padding:0px;height:22px;padding-right:3px;' id='category_input_change' />");
$(event.target).append("<ul class='styledlist' style='width:50px;float:right;'><li style='line-height:13px;' id='save_category' >ذخیره</li></ul>");
$(event.target).append("<ul class='styledlist' style='width:50px;float:right;'><li style='line-height:13px;' id='cancel_save_category' >انصراف</li></ul>") ;
category_row_editable=false;
current_dlbclick=false;
event.returnValue= false;
return false;
}
});
私はそのためにこのコードを試しています: 1:
$('#category_input_change').bind('keypress', function(e) {
if(e.keyCode==13)
alert('ddddd');
});
2:
$('#category_input_change').keyup(function (e) {
if (e.keyCode == 13)
alert('ddddd');
});