1 <button id="edit">编辑</button> 2 <p id="email">example@example.com</p> 3 <script> 4 document.getElementById("edit").onclick = function() { 5 var text = document.getElementById("email"); 6 var val = text.innerHTML; 7 text.innerHTML = "<input type='text' id='n' value=" + val + " />"; 8 document.getElementById("n").addEventListener("blur", function(e) { 9 ext.innerHTML = document.getElementById("n").value; 10 }); 11 }; 12 </script>