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:
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.
Have you tried to wait for the page to be loaded ?
Not so sure about the syntax you should check it on jQuery documentation.