jQuery Set Select Index

后端 未结 24 1715
无人共我
无人共我 2020-11-27 09:52

I have an select box:


    
    
    
    
    
    
    
    

The jquery:

$('#selectBox option[value=C]').attr('selected', 'selected');

$('#selectBox option[value=C]').prop('selected', true);

The selected item would be "Number 2" now.

提交回复
热议问题