<input type="text" class="t1" style="border: 0px;outline:none;cursor: pointer;500px" placeholder="我的个性签名" value="aa" />
$(".t1").click(function () {
var td = $(".t1");
var txt = td.text();
var input = $("<input type='text'value='" + txt + "'/>");
td.html(input);
input.click(function () { return false; });
input.trigger("focus");
});
$(".t1").blur(function () {
var td = $(".t1");
var txt = td.text();
var newtxt = $(this).val();
if (newtxt != txt) {
td.html(newtxt);
}
else {
td.html(newtxt);
}
console.log(newtxt);
$.ajax({
type: "POST",
url: "",
data: newtxt ,
dataType: "html",
error: function () {
layer.msg('服务器繁忙,请稍后再试!', {
offset: '15px',
icon: 2,
time: 1000
});
},
success: function (json) {
if (json.code > 0) {
layer.msg('上传失败,' + json.msg, {
offset: '15px',
icon: 2,
time: 1000
});
}
}
});
});
https://www.cnblogs.com/yaoyao89429/p/3805140.html