internet explorer - Setting selected index not working, jquery .Val() -


i have tried of these various ways set value of select. know id/index value , not text description. none of these work in ie , except last work in firefox.

i have set alerts make sure contactlist.pertype_id has value , number

could please tell me i'm doing wrong.

var perid = parseint(contactlist.pertype_id);  $('#ddcontacttype').val(perid);  $('#ddcontacttype').val(3);  $('#ddcontacttype option[value=3]').attr('selected', 'selected');  $('#ddcontacttype option[value='+perid+']').attr('selected', 'selected'); //does not work in ff 

turns out control trying set did not exist yet in ie. moved call method before service call , control loads fine using of methods listed above , response got below.

try prop:

$('#ddcontacttype option[value=' + perid + ']').prop('selected', true); 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -