On my webpage, there are two text areas and a division. One of the text areas is meant for users to input HTML code, while the other is for CSS code. Whenever a button is clicked, a JavaScript function will be triggered to display the combined HTML and CSS within the division.
function handleLaunch() {
var div = document.getElementById('pane');
var html = document.getElementById('h');
var css = document.getElementById('c');
div.innerHTML = html.value;
// In this part, the css value needs to be set differently: div.style = css.value;
}
<body>
<textarea id="c" placeholder="Insert CSS code here..." rows="10" cols="50"></textarea>
<div id="pane">
</div>
<br>
<textarea id="h" placeholder="Add Html code here..." rows="10" cols="50"></textarea>
<br>
<button type="button" onclick="handleLaunch()">Launch</button>
To determine how to implement the CSS as text, one must consider...
UPDATE: It should be noted that I would like to include something like ".classExample{text-align:center}" in the CSS text area and apply it on the content.