jquery set selected for select element

zyip發表於2014-04-23
//1
$("#Provider_" + counter + " option[value=" + FormData.ID + "]").attr('selected', 'selected'); //2 $("#Provider_" + counter + " option").filter(function () { return $(this).val() == FormData.ID; }).prop('selected', true); //3 $("#Provider_" + counter + " option").filter(function () { return $(this).val() == FormData.ID; }).attr('selected', true);

 

相關文章