I have the following dynamic code. I want to put the position values “left” and “top” into variables. These values change as I drag this around the screen. What I would like to do is to store the last values so that when it gets destroyed, I can reuse the values to position it at the same place the next time.
<div onmouseover="setTimer();" class="soft_add_wrapper ui-draggable" style="left: 630.5px; top: 182px;">
I have the selector I think but then I am a little fussy
var xyz = $(".soft_add_wrapper ui-draggable").attr xxxxxxxxxxxxxxx
You can get the values with
.css()like this:If it’s relative to the entire document and you want the overall position, you might consider using
.offset(), or if you want relative to the parent,.position().Note that the selector is
.soft_add_wrapper.ui-draggablesince you want to check both class selectors on the same element, there’s no space.