STOP THE PRESS!
My fault... I tried to read properties which was not set at the time I wanted to read them!
I'm using children and each to loop through children elements of a DIV. This gives me a this object which I use to move the element so it becomes a child of another element. This works nice... but I also need to access the inline style "left" of the element to be moved... just cannot figure out how to get that value...
$jquery("#thediv").children(".someclass").each(function () {
// move the element to another div
$jquery("#right").append($jquery(this));
});
The above code works nicely... But before I move the element I need to get the inline left value for the element. I have tried:
$jquery(this).css("left");
The above line give me "auto" in return, the actual value for the left is "0px". What do I have to use to get the left value?
I also would like to set the inline style to empty before moving the element... For this I have tried:
$jquery(this).attr('style', '');
The above line did not empty the inline style, it is just as originally output for the element. What do I have to use to empty the inline style for this element?
The inline style for the elements that is represented by the variable this in the loop, have the following inline style: style="position: absolute; left: 0px; top: 0px;"
where left is either "0px" or e.g. "350px" and where the top is not set to "0px" for all elements (but not of importance here)...
I came across this post: jQuery .css("left") returns "auto" instead of actual value in Chrome
where I thought I had found a solution... $jquery(this).position().left; the problem is that this allways gives me back "0", which is not correct... since every second element should have left="350px" and not "0px"
Currently I have this jquery code just before the closing body tag ... maybe that has something to do with this issue... But I thought it should not be a reason since the styles I'm trying to access is all inline.