TypeError: $(...).bootstrapValidator is not a function , it does load the ContactUs.js file, but it's not able to find the function

Shahzeb picture Shahzeb · Feb 27, 2016 · Viewed 21.5k times · Source

As the Code is given and it is not able to find the function. I have tried several changes but still get the Error the sequence is also correct. The head part is at the top script and the other environment development is at the bottom of the code between the <body> section.

<head>       
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>About Us-Azure Solutionz</title>

        <environment names="Development">
            <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
            <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jquery.bootstrapvalidator/0.5.3/css/boots‌​trapValidator.css"/>

            <link rel="stylesheet" href="css/ContactUs.css" />
            <link rel="stylesheet" href="~/css/site.css" />
             <link rel="stylesheet" href="css/NavbarButton.css"/>
            <link rel="stylesheet"  href="css/AboutUs.css"/>

              <link rel="stylesheet" href="css/Footer.css"/>
        </environment>
        <environment names="Staging,Production">
            <link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/css/bootstrap.min.css"
                  asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
                  asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
            <link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true"/>
        </environment>

    </head>
<environment names="Development">
            <script src="~/lib/jquery/dist/jquery.js"></script>
            <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
            <script src="~/js/site.js" asp-append-version="true"></script>
        </environment>
        <environment names="Staging,Production">
            <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js"
                    asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
                    asp-fallback-test="window.jQuery">
            </script>
            <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.js"></script>
            <script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/bootstrap.min.js"
                    asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
                    asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
            </script>
            <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.bootstrapvalidator/0.5.3/js/bootstr‌​apValidator.js"></script>
            <script src="js/ContactUs.js" type="text/javascript"></script>
            <script src="~/js/site.min.js" asp-append-version="true"></script>
        </environment>

Answer

bob picture bob · Feb 27, 2016

your url results in 404 error :

https://cdnjs.cloudflare.com/ajax/libs/jquery.bootstrapvalidator/0.5.3/js/bootstr‌​apValidator.js

try this link :

https://cdnjs.cloudflare.com/ajax/libs/bootstrap-validator/0.5.3/js/bootstrapValidator.js