How can I get a value out of a jQuery object?
- by Jannis
I am returning some data (example below) and saving it to a jQuery object (or is this an array and I am confusing the two?) when I log the variable that is the object it has the values I am looking for but how do I access the data inside this object?
code
$itemPosition = {
'top': $item.offset().top,
'left':$item.offset().left
},
console.log($itemPosition);
This would log out (the in this case expected) top: 0 & left: 490.
But how can I know work with those values?
Also, while this it is probably obvious I am still in the early stages of learning jQuery/Javascript rest assured that reference books are on their way, but so far the SO community has been invaluable to my learning, so thanks for reading!
J.