So, I'm in the process of building my own Task Tracker using JavaScript to enhance my skills, but I've hit a roadblock.
I successfully implemented adding a new div with user-inputted tasks, however, there's no styling involved.
<div class="isDo"> // HTML code
<p id="newTask">Task 1</p>
<hr>
</div>
function addTask() { // JavaScript Code
var div = document.createElement("div");
var taskAdd = document.getElementById("taskAdd").value;
div.innerHTML = taskAdd;
document.getElementsByClassName("isDo")[0].appendChild(div);
}
While when I append a paragraph instead of a div, it works fine with styling. However, I want to include an <hr>
tag after each input value.
Is there a way for me to dynamically add an entire div consisting of a paragraph and an <hr>
tag in this scenario?