It depends what you need. If you need the computed value - e.g. the actual value the browser used after parsing all the style sheets - use
$("#element_1").css("top")
$("#element_1").css("left")
If it's a pixel value, that is always going to be the one specified in the style
property - unless that was overridden by an !important
statement in a style sheet.
jQuery docs for .css()
If you explicitly need the value specified in the element's style
property, use
$("#element_1")[0].style.top
$("#element_1")[0].style.left
unlike .css()
, these values will be empty if they were not specified in the style
property.
(Using ID element_1
, you can't have an ID named 1
)