Today in this post I am going to share a code that will be used for making any HTML element into an editable element. Let, ‘s see the example code

<!DOCTYPE html>
<html>
<head>
<title>Editable elements</title>
</head>
<body>
<h1 contenteditable="true" id="title">This is Title</h1>

<span contenteditable="true">This is span</span>




<br>
<button onclick="myFun()">Click Me</button>
<script>
function myFun(){
var data = document.getElementById("title").innerHTML;

alert(data);
}


</script>

Leave a Reply

Your email address will not be published.