my dropdown is like
<select id="taskType">
<option value="xyz:1">Employee Name</option>
<option value="abc:2">Employee Name</option>
<option value="123:3">Employee Name</option>
<option value="efg:4">Employee Name</option>
<option value="hij:5">Employee Name</option>
</select>
i want to select the option with ":4" in the value.
i tried with string matching
$("#taskType option[value^='"+str.match(/(:4)/g)+"']").prop("selected", true);
but its not giving the result. I tried with contains function too.
$("#taskType option[value:contains(':4')]").prop("selected", true);
still didn't got the result.
can anyone help me to find whats the mistake in my code.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…