Making Div content to be Editable
Posted: 30 Mar 2015, 05:27
Can I make the content of a html div to be editable?
For example I have the following code:
I want to can edit the content of the "#edit1" Div, then, when I click on the button (Show) to alert the new content.
For example I have the following code:
Code: Select all
<div id="edit1">Content that can be edited.</div>
<button id="show">Show</button>
<script>
document.getElementById('show').addEventListener('click', function(){
var cnt = document.getElementById('edit1').innerHTML;
alert(cnt);
});
</script>