Jump to content

Get "width" value from "style" from <div> element?


pstein

Recommended Posts

Assume I have (simplified) a code like:

<div class="foobar" style="width: 632px;  margin-right:0px ">

Now I want to get resp retrieve with javascript/jQuery the width of this element;

Keep in mind that the width value shown above could vary depending on occurency.

I miss a jQuery function like

$(".foobar").getwidth();

resp. (more advanced to use in a comprehensive command).

$(".foobar").width($(".foobar").getwidth() + 120px);

How can I achieve this?

 

 

 

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...