Uncaught TypeError: $ (...). Tabs is not a function

I think there is a strange problem with jquery. I got this exception when loading the page here is my markup:

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<link href="../Layouts/en-us/css/custom.css" rel="stylesheet" />

<link href="../Layouts/en-us/css/jquery-ui.css" rel="stylesheet" />



<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

<script src="../ckeditor/ckeditor.js"></script>
<script src="../ckeditor/adapters/jquery.js"></script>
<script src="/Layouts/en-us/js/jquery-ui.min.js"></script>
</asp:Content>

here is the function causing the error

$(function () {
    $("#tabs").tabs();

    if ($("#ListBoxPages").val() == null) {
        $("#tabs").css("display", "none");
    }

    $("#ListBoxPages").change(function () {
        $("#tabs").css("display", "block");
    });

});

All relative paths to layouts and jquery were copied from another markup that works very well, without errors

+5
source share
2 answers

I see that you are loading jquery twice, so try removing this

<script src="/Layouts/en-us/js/jquery-ui.min.js" />

and save only -

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" />

then use the code below instead of your function (check the changes to this function first, then try removing this jquery-ui.min.js)

$( document ).ready(function() {
        $("#tabs").tabs();
        if ($("#ListBoxPages").val() == null) {
            $("#tabs").css("display", "none");
        }
        $("#ListBoxPages").change(function () {
            $("#tabs").css("display", "block");
        });
});
+6
source

$ ("#") Tabs Tabs (). requires jquery.UI just enable

<script src="/Layouts/en-us/js/jquery-ui.min.js" />

or use cdn

<scriptsrc="https://code.jquery.com/ui/1.12.1/jquery-ui.js"integrity="sha256-T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30="crossorigin="anonymous"></script>
+1

All Articles