HP.
HP.

Reputation: 19896

jQuery undefined error using FancyBox

I am using this http://fancybox.net/

When I do

$('a.#div1').trigger('click') 

to popup a fancybox, it gives me this error (using Firebug)

opts.itemArray[opts.itemCurrent] is undefined if (opts.itemArray[opts.itemCurren...[opts.itemCurrent].title.length > 0) {\r\n jquery.f...-1.2.1.js (line 345)

Why is that? Can you help?

Thanks.

Upvotes: 0

Views: 3196

Answers (2)

Anyul Rivas
Anyul Rivas

Reputation: 735

try one of this:

$("a.div1").trigger("click");

or

$("a#div1").trigger("click);

or

$("#div1").trigger("click");

Upvotes: 0

rahul
rahul

Reputation: 187030

$('a.#div1')

selects an anchor tag with class name #div1. I think the selector is invalid. Thats probably the reason for the error.

'.' is a class selector and '#' is id selector.

If you want to select an element with id div1 then you can write like this

$("#div1")

Upvotes: 2

Related Questions