views:

28

answers:

1

Hi to all,

i would like get the offsets of a div,but when i try to access to that div says me [Object object]... or undefined or 0.0;because i think that my method is wrong :-(

This is the code of the page:

http://pastebin.org/208836

And i have already tried with this code:

var p = $(".product_72ivnj");
var offset = p.offset();
var final =( "left: " + offset.left + ", top: " + offset.top );
alert(final);

Or this:

var p = $("#product_72ivnj");
var offset = p.offset();
var final =( "left: " + offset.left + ", top: " + offset.top );
alert(final);

But won't work :-(

Anyone can help me please?

Thanks in advance.

Kind regards.

Luca.

A: 

Hi,

Have you tried to wait for the page to be loaded ?

$(document).ready(function(){...});

Not so sure about the syntax you should check it on jQuery documentation.

Maskime
Your Syntax looks correct
Buh Buh
I have forgotten to add this code :-( .. Thanks you and to all for support :-)
Luca