未捕获的语法错误,无法识别的表达式:[object HTMLDivElement] - jQuery 1.6.2

时间:2011-10-10 10:51:23

标签: jquery syntax-error

我正在尝试在延迟后显示A标记,但是我在悬停时收到此错误消息:

  

未捕获的语法错误,无法识别的表达式:[object HTMLDivElement]

这是我正在使用的代码:

$(document).ready(function() {
        $(".folio_small").fadeTo('fast', 0.5);

        $(".folio_small").hover(
                function() {
                    $(this).fadeTo('slow', 1).delay(400);
                    $(this + ".info").fadeTo('slow', 1);
                },
                function() {
                    $(this).fadeTo('slow', 0.5);
                }
        )
    });

这是我正在使用它的一个例子:

<div class="folio_small">
    <a class="info" href="#">
        <p class="small">ILLUSTRATION</p>
    </a>
    <img src="images/portfolio/120x90_i1.jpg" alt="" />
</div>

我正在尝试在.folio_small(this)中选择.info类。我做错了吗?

1 个答案:

答案 0 :(得分:5)

$(".info",this).fadeTo('slow', 1);

OR

 $(this).children(".info").fadeTo('slow', 1);

http://jsfiddle.net/9QbGn/1/

解释@Felix Kling提供

您不能只连接DOM元素和字符串......