my dropdown is like
Try to use .filter() in this context,
$("#taskType option").filter(function(){
return $(this).val().indexOf(':4') > -1
}).prop("selected", true);
or use attribute contains(*=) selector
$("#taskType option[value*=':4']").prop("selected", true);
you can do like this:
$("#taskType option").each(function(){
if($(this).val().indexOf(":4") != -1)
{
$(this).prop("selected", true)
}
});
FIDDLE DEMO
Try This
$("#taskType option[value~=':4']").prop("selected", true);
You can use attribute ends with selector
$("#taskType option[value$=':4']").prop("selected", true);
Demo: Fiddle