JSFiddle - React, Tailwind, and code Playground
by Daniel Hall
HTML
<div id="inputWords">
<ul>
<li>
<input type="text" id="adj1">
<br>text
</li>
<!-- put other input fields here -->
</ul>
</div>
<div id="story">
</div>
<button id="replaceButton">send</button>
<div id="body"></div>
<input text id="adj1">
<br> to who
CSS
body {
font-family: "Comic Sans MS";
background-color: gray;
}
p {
font-size: 1.1em;
color: blue;
}
#inputWords {
float:left;
width: 45%;
}
ul {
list-style-type: none;
padding: 0px;
margin: 0px;
}
li {
line-height: 2em;
text-transform: uppercase;
margin-top: 8px;
}
input[type=text] {
border-width: 0 0 1px 0;
border-color: #FF00CD;
}
#buttonDiv {
text-align: center;
}
#replaceButton {
margin-top: 30px;
width: 200px;
}
#story {
margin-top: 12px;
width: 45%;
border: 1px dashed blue;
padding: 8px;
float: left;
}
.replacement {
text-decoration: underline;
text-transform: uppercase;
}
#body {
position: absolute;
top: 0%;
left: 60%;
width: 30%;
height: 70%;
background-color: gra;
}
JavaScript
var replaceButton = document
.getElementById("replaceButton");
replaceButton.addEventListener("click",replaceIt);
function replaceIt() {
var storyDiv = document.getElementById("story");
var adj1 = "<span class='replacement'>"+ document
.getElementById("adj1").value + "</span>";
/* Insert more varible definitions here */
var theStory = "<h1>hello from Daniel R</h1>";
theStory += "" + adj1 + "";
/* Put the the story here, using the +=
operator */
storyDiv.innerHTML = theStory;
}