views:

765

answers:

2

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.

+2  A: 
$('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")
rahul
A: 

try one of this:

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

or

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

or

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

anyulled