before posting the whole code, i wanted to make sure I am not missing a simple issue here.
var dv = $(myElement); var pos = dv.offset(); var width = dv.width(); var height = dv.height(); alert(pos); alert(width); alert(height);
here, width alerts fine, height alerts fine but offset alerts [object Object] (in firefox)
am I missing something here?
that’s correct: the
offset()function returns an object containing two properties,leftandtop. (See the docs). ‘[object Object]’ is how most objects are converted to strings.I’d suggest you install Firebug to help you with debugging Javascript like this as it would give you much better information about the variables.