未捕获的referenceError问题。 $未定义

时间:2020-04-14 10:24:09

标签: javascript jquery

我正在创建团队评分网站。在这里,我需要使用js,但我无法理解,这是怎么回事。

function teamopen() {
        if ($('.tb-one-middle').eq(event.page.index).hasClass('current')) { 
            $('.tb-one-middle').eq(event.page.index).removeClass('current');
        }   else {
                $('.tb-one-middle').eq(event.page.index).addClass('current');
                    }
    }

这是我的脚本,它基于元素上的click。我将在一页上复制许多元素,它们具有相同的类。因此,当我们单击element时,脚本需要打开有关带照片的团队的完整信息。首先,只有一线队上课。但是我需要将该类添加到任何其他对象中,而不要将其从现有元素中删除。

This is the screenshot of my site, on which you can see the block, which has onclick with google chrome console

This is the screenshot of html part of my site.

谢谢大家!

1 个答案:

答案 0 :(得分:0)

似乎您必须确保在执行该脚本之前已加载JQuery。