So I'm creating a form for my incremental game which allows you to choose how many protons, neutrons, and electrons are in an atom. The code for selecting how many protons is here:
<select class="form-control" id="protons_in_atom">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
I also have a button:
<button id="atom_creator" type="submit" class="btn btn-primary">Create your atom!</button>
On the click, it executes these lines of code:
document.getElementById("atom_creator").onclick = function () {
player.temp_protons_in_atom = document.getElementById("protons_in_atom");
return alert(player.temp_protons_in_atom);
};
Unfortunately, what I receive is: [object HTMLSelectElement]
How do I cause player.temp_protons_in_atom to equal the option chosen?