I have a function which selects a text based on the input string. If both matches i make it selected. PFb the function,
function setDropdownTextContains(dropdownId,selectedValue,hfId){
$('#'+dropdownId+' option').each(function(){
if($(this).text() === selectedValue){
$(this).attr("selected", "selected");
break;
}
});
$('#'+hfId).val("ModelName doesnt match");
}
I get the below error unlabeled break must be inside loop or switch ... What am i doing wrong??
breakis not in a loop orswitch. Returnfalseto stop the.eachloop.