Madalin Craciun
Madalin Craciun

Reputation: 36

Uncaught Syntax error, unrecognized expression: [object HTMLDivElement] - jQuery 1.6.2

I'm trying to get an A tag to appear after a delay but I'm getting this error message on hover:

Uncaught Syntax error, unrecognized expression: [object HTMLDivElement]

This is the code I'm using:

$(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);
                }
        )
    });

And this is an example of what I'm using it on:

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

I'm trying to select the .info class inside .folio_small (this). Am I doing it wrong?

Upvotes: 1

Views: 11361

Answers (1)

Rafay
Rafay

Reputation: 31043

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

OR

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

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

Explanation courtesy @Felix Kling

You cannot just concatenate a DOM element and a string...

Upvotes: 5

Related Questions