i have function selects text based on input string. if both matches make selected. pfb 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 below error unlabeled break must inside loop or switch
... doing wrong??
the exception text quite descriptive. can't use break
statement inside if
clause. in case should use return false
stop .each()
iteration.
Comments
Post a Comment