How can I create a basic HTML/CSS editor using Javascript? I have the code below and when I press the button, the code from HTML and CSS sections should be display with formatting in the element.
<html>
<head>
<style>
textarea {
width: 45%;
height: 200px;
background: #eee;
margin: 0 2%;
}
#content {
margin: 0 20px;
border: 1px solid #aaa;
min-height: 200px
}
h1 {
text-align: center;
font-size: 20px
}
h2 {
font-size: 18px
}
</style>
</head>
<body>
<h1>A basic HTML / CSS editor</h1>
<textarea id="html-code" placeholder="Insert HTML here"></textarea>
<textarea id="css-code" placeholder="Insert CSS here"></textarea>
<button onclick="editor()">Apply HTML and CSS</button>
<h2>Result</h2>
<div id="content">
</div>
</body>
</html>