I have a method of an object called update that generates an integer, and if it's different than the value of the region variable, assigns it to region. If the integer is the same as region then the user selects a value from a <select> dropdown menu.
I'm trying to figure out how to get the value of the <select> into the function.
<form>
Select a region Northeast Southeast North Central South Central Plains Northwest Southwest
//Destination object
var destination= function(spec) {
spec= spec||{};
var that= {};
that.update= function(newDest) {
function roll() {
return Math.floor(Math.random()*6)+Math.floor(Math.random()*6)+Math.floor(Math.random()*2)*11;
};
newDest= newDest||{};
//newDest is event
newRegion=newDest.target.value;
//newDest is empty object
newRegion= newDest.region||codes[roll()][0];
if (spec.region=== newRegion) {
//ask user for new region
//how do i use event handlers here?
};
//set new region
spec.region= newRegion;
//set new city
spec.city= newDest.city||codes[roll()][newRegion];
};
return that;
};