Uncaught TypeError: undefined is not a function in Joomla! template

Uncaught TypeError: undefined is not a function in Joomla! template

我自己的 J 模板中有这个错误,其中 jquery 由 script 标签链接。

此脚本中出现错误:

$(document).ready(function(){
    $('.login-dropdown').click(function() { //this passes (tested with alert)
        $('.login-container').show(); // there is error
    });
});

记录 - .login-containerdisplay:none 可以为 show() 方法。

我怀疑jquery和joomla有冲突,但最终不知道如何处理。

感谢您的帮助。

Joomla 使用 mootools,因此它们之间可能存在冲突。

使用$.noConflict():

jQuery.noConflict();
jQuery(document).ready(function($){
    $('.login-dropdown').click(function() { //this passes (tested with alert)
        $('.login-container').show(); // there is error
    });
});