Execute JavaScript in a modal window

Jul 7 2017 3:35 PM
Hello,
 
I have the following JS code:
 
  1. <script type="text/javascript">  
  2.     $(document).ready(function () {  
  3.         var items = "<option value='0'>Select</option>";  
  4.         $('#DistrictID').html(items);  
  5.     });  
  6. </script>  
This populate a dropdownlist with the value Select, the thing is, this dropdownlist appears in a form that it's called once the user clicks a button and then a modal windows opens, with the form in it.
 
But since it is mark as  
 
  1. $(document).ready  
 This JS won't execute with the modal, since the document is already 'ready'. How can I achieve this?
 
Thanks in advance!
 
Regards, 

Answers (3)