博客
关于我
表格 文章 - 即点即改
阅读量:581 次
发布时间:2019-03-11

本文共 1353 字,大约阅读时间需要 4 分钟。

基于jQuery的即点即改功能实现,简单而实用,功能完整且支持发送请求。以下将从HTML、CSS和JavaScript三个方面详细说明实现过程。

**

基于jQuery的即点即改,简单实用,完整的,包括发送请求!

**

**

html

**

IDcard Name Address
1 袁梦坤 河南省商丘市柘城县
2 刘凯歌 河南省商丘市柘城县

**

css

**

td {  border: 1px solid #0094ff;  text-align: center;}

**

js(注释详细,便于新手理解)

**

$(function() {  $(document).on("click", ".gai", function() {    //避免在文本输入框上点击    if ($(this).children("input").prop("type") == 'text') return false;    //获取并存储原有文本    var data = $(this).html();    //生成带有输入框的新内容    var input = '';    $(this).html(input);    //自动获得光标位置    $(this).children("input").focus();  });  $(document).on("blur", "#ai", function() {    //获取修改后的内容    var data = $(this).val();    //确定修改的ID    var id = $(this).parents("tr").prop("id");    //确定修改的字段    var param = $(this).parent().attr("param");    //输出修改信息提示    alert("修改的ID:" + id + "|" + "修改的字段:" + param + "|" + "修改后的内容:" + data);    //发送AJAX请求    $.ajax({      type: "post",      url: "",      data: {        "data": data,        "id": id,        "param": param      },      success: function(data) {        if (data == 1) {          obj.parent().html(data);        }      }    });  });});

转载地址:http://chnvz.baihongyu.com/

你可能感兴趣的文章
Notification 使用详解(很全
查看>>
NotImplementedError: Cannot copy out of meta tensor; no data! Please use torch.nn.Module.to_empty()
查看>>
Now trying to drop the old temporary tablespace, the session hangs.
查看>>
nowcoder—Beauty of Trees
查看>>
np.arange()和np.linspace()绘制logistic回归图像时得到不同的结果?
查看>>
npm error Missing script: “server“npm errornpm error Did you mean this?npm error npm run serve
查看>>
npm error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。要解决此问题,1) 安装
查看>>
npm install digital envelope routines::unsupported解决方法
查看>>
npm install 卡着不动的解决方法
查看>>
npm install 报错 EEXIST File exists 的解决方法
查看>>
npm install 报错 ERR_SOCKET_TIMEOUT 的解决方法
查看>>
npm install 报错 fatal: unable to connect to github.com 的解决方法
查看>>
npm install 报错 no such file or directory 的解决方法
查看>>
npm install报错,证书验证失败unable to get local issuer certificate
查看>>
npm install无法生成node_modules的解决方法
查看>>
npm install的--save和--save-dev使用说明
查看>>
npm node pm2相关问题
查看>>
npm run build 失败Compiler server unexpectedly exited with code: null and signal: SIGBUS
查看>>
npm run build报Cannot find module错误的解决方法
查看>>
npm run build部署到云服务器中的Nginx(图文配置)
查看>>