Skip to content
Loading
Disable Dropdown  
  •             class="form-group">  
  •                 for="Phone" class="control-label">  
  •                 for="Phone" class="form-control" id="phone" />  
  •                 for="Phone" class="text-danger">  
  •               
  •               
  •             class="form-group">  
  •                 "ddlBranch" class="m-b-sm  w-lg form-control" onchange="ViewHistoricData()">  
  •                     "ALL" selected="selected">ALL  
  •                     "First">First Item  
  •                      "Second">Second  
  •                   
  •               
  •   
  •             class="form-group">  
  •                 "button" id="submit" class="btn btn-primary" onclick="submitStudent()">Add   
  •               
  •   
  •           
  •       
  •   
  •   
  • @section Scripts {  
  •     @{  
  •     await Html.RenderPartialAsync("_ValidationScriptsPartial");  
  • }  
  • }  
  • +2
  • Vishal Yelve
    Hi Ramco,
     
    Try this 
     
    1. "text/javascript">    
    2.     $(document).ready(function () {           
    3.         $("#ButtonID").click(function () {    
    4.             $("#ddlStatus").attr("disabled""disabled");  
    5.         });    
    6.     });    
    7.     
    8.   
    9. ------------------------ OR  
    10.   
    11. "text/javascript">    
    12.     $(document).ready(function () {           
    13.         $("#ButtonID").click(function () {    
    14.            $('#ddlStatus').prop('disabled'true);  
    15.         });    
    16.     });    
    17.     
     
    +2
  • Hi Vishal
     
       Where i should write your code
     
    Thanks 
    +2
  • Vishal Yelve

    Try this to disable dropdown on Button click 

    $("#ddlStatus").attr("disabled", "disabled");

    +2
  • Sachin Singh
    In that case you need to open the Modal popup with Javascript and not with data-target attribute.
     
    1. "button" class="btn bg-info btn-sm">class="icon-plus22 mr-2">Add Academy  
      
    1. $("#btnAdd").click(function(){  
    2.  $("#dllStatus").prop("disabled"true);  // check Id is correct if inside master page use [id^='ddlstatus']
    3. $("#modal_form_horizontal").modal('show');  
    4. });  
     
    +2
  • Hi Satya
     
      Below is the code
     
    Thanks 
    +2
  • Satya Karki
    Hi try below,
     
    1. "text/javascript">  
    2.     $(document).ready(function () {         
    3.         $("#IDofButtonAdd").click(function () {  
    4.             $("#ddlStatus").removeAttr("disabled");  
    5.         });  
    6.     });  
    7.   
     
    +2