Javascript contenteditable的用途是什么?我可以将其用作“编辑配置文件”按钮吗
contenteditable在html5中的用途是什么?我如何在mongoose/MongoDB中保存contenteditable div中的更改并向用户显示这些更新的详细信息Javascript contenteditable的用途是什么?我可以将其用作“编辑配置文件”按钮吗,javascript,html,node.js,mongodb,mongoose,Javascript,Html,Node.js,Mongodb,Mongoose,contenteditable在html5中的用途是什么?我如何在mongoose/MongoDB中保存contenteditable div中的更改并向用户显示这些更新的详细信息 <h2>Edit your profile username:</h2> <div id="text" contenteditable="true"> bisc452 </div> <button>Save Changes</button&g
<h2>Edit your profile username:</h2>
<div id="text" contenteditable="true">
bisc452
</div>
<button>Save Changes</button>
编辑您的个人资料用户名:
bisc452
保存更改
我希望它可以在不使用javascript的情况下完成,因此用户禁用javascript时,他可以保存更改,但如果需要使用javascript或jquery,也很好如果您只是向用户请求纯文本,如profile username,则不需要contenteditable。您只需使用
标记即可
HTML-
编辑您的个人资料用户名:
保存更改
javascript-
function myFunction(profileUserName) {
console.log("Profile username : "+ profileUserName);
// Save this value in MongoDB here
}
function myFunction(profileUserName) {
console.log("Profile username : "+ profileUserName);
// Save this value in MongoDB here
}
Contenteditable通常用于编辑,例如StackOverflow用来编写问答,其中用户输入的不仅是文本,而且是具有某种格式的文本。如果出于任何原因希望使用contenteditable,则-
编辑您的个人资料用户名:
bisc452
保存更改