I have a simple code, which goes with a more complex code though I will only be showing the snippet in the object notation.
var test = {
add: {
select: function(options){
console.log(options.id);
console.log(options.className);
onchange: function(){
//code here
}
}
}
}
That is the code above, as I've tried many instances to make this work firing Vanilla JS or even jQuery to make it fire. The code to make it work would look like this-
test.add.select({
id:'id',
className: 'class',
onchange: function(){
if(key===0){
console.log('0');
}else if(key===1){
console.log('0');
}else if(key===2){
console.log('0');
}
}
});
Key is being set as the actual select menu key. Please see the JSBIN for a much better visual.
http://jsbin.com/amonid/1/edit
Basically when the select is change for now console.logging is what I am doing, later on I will change it for the needs I have. Can someone explain to me how I would go about adding this all?