What is wrong with this jquery each() select options? -


i have below function,

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

and passing dropdownid=$('#dp1") , selectedvalue='bat' , reason each() function not getting executed.. calling setdropdownvalue($("#dp1"),'bat');am missing something??

dropdownid should string, why passing $('#dp1") jquery object?

you should pass 'dp1' instead.


Popular posts from this blog

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -