The following two are giving different results:

$("#service_select").change(function() {
   alert($("#service_select").val());
}

$(document).ready(function() {
   if ($("#service_select option:selected")) {
      alert($("#service_select").val());
   }
}


Onchange I get the option value. On document ready I get the text.

So when I choose something from the select element I get 2,3,4 etc.

But on reload I get 'Alpha', 'Beta', 'Gamma' etc..

This is happening in both IE and Firefox.

I want to trigger events based upon the selected value, but I don't
want to use the text as this may change.

Any ideas?

Thanks,
Tim.

Reply via email to