Hello I need to have fields be added and taken away with plus and minus buttons. Whenever I add a field it works fine. When I enter something into a field then add another field, the previous field resets. Also, whenever I click the minus button it removes all of the fields. I want it to take one away at a time without resetting the other fields and also I keep getting a Not a Number (NaN) error whenever I click the minus button. Any help is greatly appreciated. I'll show my code below.
<input name="+" type="button" id="+" onclick="addInput()" value="+" label="+" />
<input name="-" type="button" id="-" onclick="subtractInput()" value="-" label="-" />
<span id="response"></span>
<script>
    var countBox = 1;
    var boxName = 0;
    function addInput() {
        var boxName = "#";
        document.getElementById('response').innerHTML += '<br/><input type="text" id="' + boxName + '" value="' + boxName + '" "  /><br/>';
        countBox += 1;
    }
    function subtractInput() {
        var boxName = "#";
        document.getElementById('response').innerHTML -= '<br/><input type="text" id="' + boxName + '" value="' + boxName + '" "  /><br/>';
        countBox -= 1;
    }
</script>
 
     
     
     
     
     
    
')});` – DaMuffiner Jan 30 '14 at 17:01