Skip to content

Instantly share code, notes, and snippets.

@jameswyse
Last active April 23, 2022 13:25
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jameswyse/b5b9f42bf38e7c09262cb37ea44ce626 to your computer and use it in GitHub Desktop.
Save jameswyse/b5b9f42bf38e7c09262cb37ea44ce626 to your computer and use it in GitHub Desktop.
Bookmarklet to toggle ContentEditable
javascript:(function(e,n,o,t){o=e.body,t=%22true%22==o[n],o[n]=t%3F%22false%22:%22true%22,e.designMode=t%3F%22off%22:%22on%22})(document,%22contentEditable%22)
(function () {
if (document.body.contentEditable === 'true') {
document.body.contentEditable = 'false';
document.designMode = 'off';
} else {
document.body.contentEditable = 'true';
document.designMode = 'on';
}
}())
(function(d,e,b,s){b=d.body;s=b[e]=='true';b[e]=s?'false':'true';d.designMode=s?'off':'on'}(document,'contentEditable'))
@RAYARAYUMA
Copy link

t

@deryilz
Copy link

deryilz commented Jul 5, 2020

cool!

@HT-7
Copy link

HT-7 commented Apr 23, 2022

In an old text file, I found:
if (document.designMode=='off') { document.body.contentEditable='true'; document.designMode='on';} else { document.body.contentEditable='false'; document.designMode='off';} void 0;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment