Solution :
To fix your issue you must remove the contenteditable
attribute as shown in below code snippet for your reference.
var mydemo_editable = document.getElementById('mydemo-editable');
var mydemo_button = document.getElementById('mydemo-button');
mydemo_editable.setAttribute('contenteditable',true);
mydemo_button.onclick = function() {
delete mydemo_editable.removeAttribute('contenteditable');
}
<div id="mydemo-editable">This is editable</div><button id="mydemo-button">Make not editable</button>
To fix your issue you can also try to set the attribute contenteditable
to false as shown in below code snippet for your reference.
varmy demo_editable = document.getElementById('mydemo-editable');
var mydemo_button = document.getElementById('mydemo-button');
mydemo_editable.setAttribute('contenteditable',true);
mydemo_button.onclick = function() {
delete mydemo_editable.setAttribute('contenteditable',false);
}
<div id="mydemo-editable">This is editable</div><button id="mydemo-button">Make not editable</button>
If above solutions are not helping you then you can try below method to fix your issue.
a) You need to first hit the F12 to inspect your page
b) After that you can right-click on a top-most element a <html> tag
c) Now from a resulting context menu you should select "Edit as HTML"
d) You should focus your editable HTML and then you should hit Ctrl+A to select all
e) Then you can hit Ctrl+C to simply copy the page's HTML to the clipboard
f) Now you can make your edits to your contenteditable section
g) After doing above steps you should repeat steps 1 through 4
h) Finally press Ctrl+V to paste over your edited HTML with your page's original HTML
Hope my above solutions help you in fixing your issue.