$(…).tabs is not a function

后端 未结 8 1673
隐瞒了意图╮
隐瞒了意图╮ 2021-01-07 22:42

I have this code on two pages on my site, but at one page the function doesn\'t work. Firebug shows me \" $(...).tabs is not a function \". I don\'t understand why, can anyo

8条回答
  •  攒了一身酷
    2021-01-07 22:57

    The error Uncaught TypeError: $(...).tabs is not a function may also be produced when in a Django project on the Admin area and using django-tabbed-admin under the following setup:

    • Django = 1.10.5
    • django-tabbed-admin=1.0.4
    • DEFAULT_JQUERY_UI_JS = 'tabbed_admin/js/jquery-ui-1.11.4.min.js'

    The problem is that the code in jquery-ui-1.11.4.min.js for this Django lib is as follows:

        /*! jQuery UI - v1.11.4 - 2015-07-27
        (...)*/
        jQuery = jQuery || django.jQuery.noConflict(false);
    

    and the code on django-tabbed-admin uses it this way (change_form.html):

        
        
    

    To sort this out this should be what would be passed in to the IIFE instead of the (django.jQuery) as above:

    
        
    

    I've reported this issue in the project and created a PR with a fix for it. Waiting on it to be approved, so in the meantime you can sort it following my simple fix.

    I hope this helps someone out there.

提交回复
热议问题