1. 程式人生 > >select根據text預設選中

select根據text預設選中

var strainGene = vm.detailObj.strainGene;
console.log(strainGene);

$(".aim-select").find("option").each(function (data) {
    var $this = $(this);
    if($this.text() == strainGene) {
        $this.attr("selected", true);
    }
});