依赖jquer,layui/css


<td class="My_edit"></td>


//-----[Layui表格编辑(<td class="My_edit"></td>)] 2018-11-13
function Layui_edit(){
	//数据可编辑
	$(".My_edit").toggle(function(){
		var text=$(this).html();
		$(this).html('<input type="text" class="layui-input layui-table-edit" value="'+text+'">');
        $(this).children("input").val("").focus().val(text);
	},function(){
		$(this).html($(this).children("input").val());
	})
	//数据编辑失去焦点失效
	$(".layui-table-edit").live("blur",function(){
		var text=$(this).val();
		$(this).parent().html(text);
	})
}
//-----[Layui表格编辑END]

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-14
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案