Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/446.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 下拉列表不出现在可编辑表格单元格中_Javascript_Jquery_Html_Css_Dropdown - Fatal编程技术网

Javascript 下拉列表不出现在可编辑表格单元格中

Javascript 下拉列表不出现在可编辑表格单元格中,javascript,jquery,html,css,dropdown,Javascript,Jquery,Html,Css,Dropdown,我想创建一个可编辑的表。我可以在其中更改表格单元格的内容。简单输入工作正常,但下拉或选择不起作用。这是我所做的一个例子 $(函数(){ $(“td”)。单击(函数(){ var OriginalContent=$(this.text(); 控制台日志(原始内容); $(this.addClass(“cellEditing”); $(this.html(“123”); $(this.children().first().focus(); $(this).children().first().ke

我想创建一个可编辑的表。我可以在其中更改表格单元格的内容。简单输入工作正常,但下拉或选择不起作用。这是我所做的一个例子

$(函数(){
$(“td”)。单击(函数(){
var OriginalContent=$(this.text();
控制台日志(原始内容);
$(this.addClass(“cellEditing”);
$(this.html(“123”);
$(this.children().first().focus();
$(this).children().first().keypress(函数(e){
如果(e.which==13){
var newContent=原始内容;
$(this.parent().text(原始内容);
$(this.parent().removeClass(“cellEditing”);
log('value'+$(this.val());
}
});
$(this.children().first().blur(function()){
$(this.parent().text(原始内容);
$(this.parent().removeClass(“cellEditing”);
});
});
});
.editable{
边框:实心0px;
宽度:100%;
文本对齐:居中
}
.可编辑表格td{
边框:实心1px;
}
.editableTable.cellEditing{
填充:0;
}
挑选{
边界:0px;
边框颜色:无
}

0
0
0
0
0
0
0
0
0
0
0
0

您需要为表中的编辑功能设置自定义按钮。 在您的代码中,当您第一次单击td时,您的单击事件为fire。 同时,当您当时单击下拉列表时,也单击事件触发。
因为下拉选项显示不正确

谢谢您的回复,但我不想设置任何自定义按钮使其可编辑。我通过双击使单元格可编辑来区分它们,然后下拉列表将出现,并保持在那里,直到我按enter键或tab键。