Jump to content

Get A Style Attribute

Guest cfican

Recommended Posts

I'd like to be able to get the style.left value. I can set the left edge of an element with

document.getElementById(obj).style.left = 15px

how can I get the current value?

Edited by cfican
Link to comment
Share on other sites

You can read the property:


Keep in mind that unless you've actually set the style attribute of the element, the property will be empty. It doesn't obtain the style that was given through the stylesheet.But rather than finding the style property, if you want to check the position use offsetLeft and offsetTop:


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...