I have a reset function, which selects the id of an input.
I have a button which fires the function when clicked.
Where am I going wrong here? I thought maybe it was because my input was not in a form, and that i would need to create a form and give it an id to reference. But that didn't work either.
I also tried using document.getElementById.("reset").reset();
This didn't work either.
im lost!
function clearInputs(){
document.getElementById("reset").value = "";
}
<div class="container">
<div class="cell-1" id="centerElement">
<div id="cell-1-nest-l"></div>
<div id="cell-2-nest-l"></div>
<div id="cell-3-nest-l"></div>
<div id="cell-4-nest-l"><h3>your name</h3></div>
<div id="cell-5-nest-l"></div>
<div id="cell-6-nest-l"><input type="text" class="nameStyle1" id="nameInput1" class="reset"></div>
<div class="cell-2" id="centerElement" ><img onclick="getSum();" src="file:///Users/Nineborn/Downloads/My%20Post%20(5).png" alt=""></div>
<div class="cell-3" id="centerElement" >
<div id="cell-1-nest"></div>
<div id="cell-2-nest"></div>
<div id="cell-3-nest"><h3>their name</h3></div>
<div id="cell-4-nest"></div>
<div id="cell-5-nest"><input type="text" class="nameStyle1" id="nameInput2"></div>
<div id="cell-6-nest"></div>
</div>
<div class="cell-4" id="result1">
<input type="date" class="dateStyle1" id="dateInput1">
</div>
<div class="cell-5"><input type="button" value="Reset" onclick="clearInputs();"></div>
<div class="cell-6" id="result2">
<input type="date" class="dateStyle2" id="dateInput2" placeholder="Their Bday">
</div>
<div class="cell-7"></div>
<div class="cell-8"></div>
<div class="cell-9"></div>