make the whole page a text editor in html code example
Example 1: how to make an html document
First, you have to tick "File name extensions" if you haven't.
Secondly, you need to make a file somewhere in YOUR user. Make sure that it
ends with .html
Then, copy this code:
<!DOCTYPE html>
<html>
<head>
<title>Name your document title</title>
</head>
<body>
Put your document apperance here...
</body>
</html>
Finally, open the HTML document and then you have your page!
Example 2: how to make a text editor in html
function chooseColor(){
var mycolor = document.getElementById("myColor").value;
document.execCommand('foreColor', false, mycolor);
}
function changeFont(){
var myFont = document.getElementById("input-font").value;
document.execCommand('fontName', false, myFont);
}
function changeSize(){
var mysize = document.getElementById("fontSize").value;
document.execCommand('fontSize', false, mysize);
}
function checkDiv(){
var editorText = document.getElementById("editor1").innerHTML;
if(editorText === ''){
document.getElementById("editor1").style.border = '5px solid red';
}
}
function removeBorder(){
document.getElementById("editor1").style.border = '1px solid transparent';
}