How to set the 'selected option' of a select dropdown list with jquery

后端 未结 6 1501
南笙
南笙 2021-01-31 09:07

I have the following jquery function:

$.post(\'GetSalesRepfromCustomer\', {
    data: selectedObj.value
}, function (result) {
    alert(result[0]);
    $(\'sele         


        
6条回答
  •  余生分开走
    2021-01-31 09:48

    You have to replace YourID and value="3" for your current ones.

    $(document).ready(function() {
      $('#YourID option[value="3"]').attr("selected", "selected");
    });
    
    

    and value="3" for your current ones.

    $('#YourID option[value="3"]').attr("selected", "selected");
    
    
    

提交回复
热议问题