HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body onkeydown="myFunction()"> <p>Select this text and press shift and do it again.</p> <script> document.designMode = "on"; function myFunction(){ if(event.keyCode == 16){ var state = document.queryCommandState("bold"); if(state) alert("Bold formatting will be removed"); else alert("Bold formatting will be added"); document.execCommand('bold'); } } </script> </body> </html>
OUTPUT
×

Save as Private