Home > other >  How to load JavaScript Css files in partial view
How to load JavaScript Css files in partial view

Time:11-28

I have a partial view page, I want to load JavaScript And Css files in this partial view. Please help me how do I do this?

I want to load these three files in Partial View

<link href="~/AdminTheme/BootstrapJalaliDatePicker/css/bootstrap- 
    datepicker.min.css" rel="stylesheet" />
 <script src="~/AdminTheme/BootstrapJalaliDatePicker/js/bootstrap- 
    datepicker.min.js"></script>
<script src="~/AdminTheme/BootstrapJalaliDatePicker/js/bootstrap- 
    datepicker.fa.min.js"></script>

Partial View:

     <div class="col-md-12">               
        <div class="col-md-6">
        <div class="form-group">
         <label asp-for="StartDate" class="control-label">StartDate</label>
            <input  id="sdDate" class="Date form-control" name="stDate"/>    
             <span asp-validation-for="StartDate" class="error"></span>
            </div>
             </div>
             
    <div class="col-md-6">
      <div class="form-group">
        <label asp-for="EndDate" class="control-label">EndDate</label>
                <input id="edDate" class="Date form-control" name="edDate"/>
                <span asp-validation-for="EndDate" class="error"></span>
            </div>
             </div>
        </div>

 <script type="text/javascript" language=javascript>                  
    $(document).ready(function() {       
           $('.Date').datepicker({ dateFormat: "yy/mm/dd", isRTL: true, 
            showButtonPanel: true });
        });       
 </script>

CodePudding user response:

The solution obtained:

   $(document).on("focusin",".Date", function () {
         $(this).datepicker({
            dateFormat: "yy/mm/dd", 
            isRTL: true, 
            showButtonPanel: true
           });
        });  

add css:

.datepicker{z-index:1151 !important;}
  • Related