Using javascript – we can set the element relative position such as
object.style.position="absolute"||"fixed"||"relative"
But,on using the same console.log(object.style.position) – it does not return the position applied on the object – it returns NULL. Am i missing something here or is there another way to achieve what i’m trying to achieve??
.stylerepresents what’s set on the element itself, much like thestyleattribute.You could instead use
getComputedStyle: http://jsfiddle.net/qAbTz/1/.