I would like to use a onchange state on a select element to check if the value of the select is in an array.
I tried this :
function statutEmployeur(){
statliste = [];
statliste.push(1);
statliste.push(2);
statliste.push(5);
statid = jQuery("#statut").val();
if(jQuery.inArray(statid,statliste)>-1){
alert('inside array');
}else {
alert('outside array');
}
}
Each value that I tried are outside of the array. Anybody can help me ?
Thanks
"1"is not considered to be in an array of[1, 2, 5]