Set select option 'selected', by value

后端 未结 28 2951
攒了一身酷
攒了一身酷 2020-11-22 10:40

I have a select field with some options in it. Now I need to select one of those options with jQuery. But how can I do that when I only know the

28条回答
  •  忘掉有多难
    2020-11-22 11:25

    The easiest way to do that is:

    HTML

    
    

    jQuery

    $('select[name="dept"]').val('3');
    

    Output: This will activate ENT.

提交回复
热议问题