未捕获的类型错误:未定义不是 Joomla 中的函数!模板 [英] Uncaught TypeError: undefined is not a function in Joomla! template

查看:19
本文介绍了未捕获的类型错误:未定义不是 Joomla 中的函数!模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在自己的 J 模板中有这个错误,其中 jquery 通过 script 标签链接.

I've this error in my own J template, where jquery is linked by script tag.

此脚本中出现错误:

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

记录 - .login-container 具有 display:none 可以用于 show() 方法.

for record - .login-container has display:none which could by right for show() method.

怀疑是jquery和joomla的冲突,最终不知道怎么处理.

I suspect the conflict between jquery and joomla, but do not know how to deal with it eventually.

感谢您的帮助.

推荐答案

Joomla 使用 mootools,所以它们之间可能存在冲突.

Joomla uses mootools, so there might be conflict between them.

使用$.noConflict():

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

这篇关于未捕获的类型错误:未定义不是 Joomla 中的函数!模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆