skip to Main Content

I am getting the below error, however the js file is accessible

Refused to apply style from ‘bootstrap-datepicker.min.js’ because its MIME type (‘application/javascript’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.

It was working fine.

2

Answers


  1. It appears that you are attempting to include the JavaScript file "bootstrap-datepicker.min.js" as a stylesheet in your HTML. This error message lets you know that it won’t accept javascript files, it will only accept stylesheet (eg CSS ) files.

    If you mistakenly included the "bootstrap-datepicker.min.js" file as a link to your stylesheet, you should remove it and include the correct CSS file.

    If not like this, please provide enough code or a minimal reproducible example.

    Login or Signup to reply.
  2. Try this bootstrap-datepicker I hope it’s helpful for you.

    cdn link

        <link rel="stylesheet"
        href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
        integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    
    <!-- Optional theme -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap-theme.min.css"
        integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
    
    <!-- Latest compiled and minified JavaScript -->
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"
        integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
        crossorigin="anonymous"></script>
    <script
        src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.min.js"></script>
    

    html

     <div class="form-group" layout="row" style="margin-top:4px;">
            <span style="margin-top:7px" flex="20">Date</span>
            <input placeholder="dd MM yyyy" style="text-align:center;font-size:12px;margin-top: 5px; border-radius: 7px; width: 50%; height: 36px;" type="text" class="form-control datepicker" id="datepicker"  ng-model="date">
        </div>
    

    js

     $('.datepicker').datepicker({
            format: 'dd MM yyyy', // Date format
            autoclose: true, 
            todayHighlight: true // Highlight today's date
        });
    

    I hope you like it.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search