Can someone help me understand why the console log fails to print the value if I wrap the input field in a form field?
HTML:
<form>
<input id="formEntry" type="text">
<button id="btn-3">Add Custom Line</button>
</form>
JavaScript:
var addCustomLine = function(){
var customLine = document.getElementById("formEntry").value;
console.log(customLine);
}
document.getElementById("btn-3").addEventListener ("click", addCustomLine, false);
<form>tags?