What the code syas to me is that if 'dog' is selected an alert box will say 'yay dog' and for everything else it should alert 'boo no dog' but it says boo even when dog is selected. what am I doing wrong.
Code: Select all
var fieldWin = new Window('dialog', 'Field Init');
fieldWin.fields = fieldWin.add('panel', undefined, 'fields');
fieldWin.fields.groupx = fieldWin.fields.add('group', undefined);
drop = fieldWin.fields.groupx.add('dropdownlist', undefined, ['dog', 'cat', 'fish']);
drop.onChange = function () {
alert(this.selection);
if(this.selection == 'dog'){
alert('yay dog');
}else{
alert('boo no dog');
}
}
fieldWin.show();