I am attempting to customize a text box generated using JavaScript by assigning an ID to the created element in the following manner:
const x = document.createElement("INPUT");
x.setAttribute("type", "text");
document.getElementById("textBoxForText").appendChild(x);
window.data.appendChild(x);
Here is my CSS:
.textBox {
border: 2px solid red;
border-radius: 4px;
}
Despite trying to reference the element by its ID in my HTML file, it doesn't seem to be working:
<div id="textBoxForText" class = "textBox"></div>
Is there a way to resolve this issue without resorting to innerHTML?