jquery - What is wrong in this javascript dropdown select function? -


i calling reusable function sets selected value dropdown. missing here??

function setdropdownvalue(dropdownid,selectedvalue){             $(dropdownid 'option').each(function(){                  if ($(this).val().tolowercase()==selectedvalue.tolowercase()){                      //found option  looking for, want                      $(this).val(selectedvalue);                  }             });         } 

and calling like,

function setselectedsport(selsport,tempcount){          setdropdownvalue($("#sportid2"),selsport);     } 

i getting undefined error in $(dropdownid 'option').each(function(){ .. missing here??

edit:

after changing $('#'+dropdownid+' option').each(function(){ ecah() function doesnt seem executed.

looks you're missing concatenation operator , hash tag id. try:

$('#'+dropdownid+' option') 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -