简体   繁体   中英

How to load JavaScript Css files in partial view

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>

The solution obtained:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM