I check the condition here to select a value from the drop-down list. But the next line doesn't work, it seems.
<option value="Chairman"'+ val["designation"]== "Chairmain" ? "selected" : "" +'>Chairman</option>
I think there is a problem with 'and ". I tried many ways to fix this, but that didn't help.
Below is my complete code that I am using:
$.each(management_details,function(key,val){
cnt++;
htm += '<select name="management[]" class="repeat-select-management">\n\
<option value="0">Select Management</option>\n\
<option value="Chairman"'+ val["designation"]== "Chairmain" ? "selected" : "" +'>Chairman</option>\n\
<option value="Vice Chairman">Vice Chairman</option>\n\
<option value="Vice Chancellor">Vice Chancellor</option>\n\
<option value="Secretary">Secretary</option>\n\
<option value="Registrar">Registrar</option>\n\
<option value="Dean">Dean</option>\n\
<option value="Owner">Owner</option>\n\
<option value="Other">Other</option>\n\
</select>';
});
Can someone tell me how to fix this?
source
share