I want to pass the value obtained from the html object, convert this value to an integer so that I can do arithmetic before outputting it. Since my code is standing now, it just adds them as a string. Thus, the value of 5 + modifier 100 ends up equal to = 5100, not 105.
Here is my form code:
<form> Add Amount: <select id="addTweets"> <option value=5>5</option> <option value=10>10</option> <option value=15>15</option> </select> </br> <input type="button" value="Add It" onclick="addTweet()" /> </form>
Here is my script:
function addTweet() { var mod = 100; var results = document.getElementById("addTweets").value; results += mod; document.getElementById("tweetsOutput").innerHTML = results; }
source share