Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/76.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
嗨,如何只编辑几列而不是全部?关于jquery和html?_Jquery_Html_Ajax - Fatal编程技术网

嗨,如何只编辑几列而不是全部?关于jquery和html?

嗨,如何只编辑几列而不是全部?关于jquery和html?,jquery,html,ajax,Jquery,Html,Ajax,我只想编辑日期和值,如何修复此缺陷?下面是代码 $(文档).ready(函数(){ $('tblEditavel tbody tr')。每个(功能(i){ $(this).children('td')。每个(函数(p){ $(this).dblclick(function(){ 如果($('td>input')。长度>0){ 返回; } var conteudoooriginal=$(this.text(); var novoElemento=$('',{type:'text',value:c

我只想编辑日期和值,如何修复此缺陷?下面是代码

$(文档).ready(函数(){
$('tblEditavel tbody tr')。每个(功能(i){
$(this).children('td')。每个(函数(p){
$(this).dblclick(function(){
如果($('td>input')。长度>0){
返回;
}
var conteudoooriginal=$(this.text();
var novoElemento=$('',{type:'text',value:conteudoooriginal});
$(this.html(novoElemento.bind('blur keydown',function(e)){
var-keyCode=e.which;
var conteudoNovo=$(this.val();
if(keyCode==13&&conteudoNovo!=''&&conteudoNovo!=conteudoooriginal){
var objeto=$(本);
$.ajax({
类型:“POST”,
url:“alterar.php”,
数据:{
id:$(this).parents('tr').children().first().text(),
campo:$(this.parent().attr('title'),
勇敢:孔杜多诺沃
},
成功:功能(结果){
objeto.parent().html(conteudoNovo);
$('body')。追加(结果);
}
})
var Posico=p+1;
$(this.parent())
.html(conteudoNovo)
.父母(tr)
.next()
.children('td:n个children('+posicao+'))
.trigger('dblclick');
} 
else if(keyCode==27 | | e.type=='blur')
$(this.parent().html(conteudoooriginal);
}));
$(this.children().select();
});
});
});
})
表格{
边界塌陷:塌陷;
}
表,td,th{
边框:1px纯黑;
填充物:5px;
}

身份证件
名称
R$
日期工资
74
微软
2.350,00
10/02/2017
75
微软
2.350,00
10/03/2017
76
微软
2.350,00
10/04/2017
77
微软
2.350,00
10/05/2017
78
微软
2.350,00
10/06/2017
使用
$(“#tblEditavel tbody tr td.editavel”).dblclick()
可以工作,只要你把
class=“editavel”
从名称中去掉
td
s

$(文档).ready(函数(){
$('#tblEditavel tbody tr td.editavel').dblclick(函数(p){
如果($('td>input')。长度>0){
返回;
}
var conteudoooriginal=$(this.text();
var novoElemento=$(''{
键入:“文本”,
值:conteudoOriginal
});
$(this.html(novoElemento.bind('blur keydown',function(e)){
var-keyCode=e.which;
var conteudoNovo=$(this.val();
if(keyCode==13&&conteudoNovo!=''&&conteudoNovo!=conteudoooriginal){
var objeto=$(本);
$.ajax({
类型:“POST”,
url:“alterar.php”,
数据:{
id:$(this).parents('tr').children().first().text(),
campo:$(this.parent().attr('title'),
勇敢:孔杜多诺沃
},
成功:功能(结果){
objeto.parent().html(conteudoNovo);
$('body')。追加(结果);
}
})
var Posico=p+1;
$(this.parent())
.html(conteudoNovo)
.父母(tr)
.next()
.children('td:n个children('+posicao+'))
.trigger('dblclick');
}else if(keyCode==27 | | e.type=='blur')
$(this.parent().html(conteudoooriginal);
}));
$(this.children().select();
});
})
表格{
边界塌陷:塌陷;
}
桌子
运输署,
th{
边框:1px纯黑;
填充物:5px;
}

身份证件
名称
R$
日期工资
74
微软
2.350,00
10/02/2017
75
微软
2.350,00
10/03/2017
76
微软
2.350,00
10/04/2017
77
微软
2.350,00
10/05/2017
78
微软
2.350,00
10/06/2017

绑定事件处理程序时不需要使用
.each()
。只要绑定到整个集合,jQuery就会自动迭代。我不明白你想要什么。是否要使R$和日期付款字段可编辑?就像你点击它一样?@Nezih是的,只有这两个字段,而不是整个表。谢谢。@WagnerFernandomoso我会给你做个演示。编辑:这个怎么样?请在@Barmar查看此代码,该代码是功能性的,当回车时,它会转到下一行,但所有td都在编辑中,但我只想限制两列pay和date