# Change width of DIV via JavaScript

**URL:** <https://forum.kirupa.com/t/change-width-of-div-via-javascript/273784>\
**Category:** web dev\
**Created:** [October 20, 2008, 9:07pm UTC](https://forum.kirupa.com/t/change-width-of-div-via-javascript/273784 "2008-10-20T21:07:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alemieux34](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@alemieux34](https://forum.kirupa.com/u/alemieux34)\
**Post date:** [October 20, 2008, 9:07pm UTC](https://forum.kirupa.com/t/change-width-of-div-via-javascript/273784/1 "2008-10-20T21:07:31Z")

</div>

I want to dynamically change the width of a div via a JavaScript variable. Something like the following:

```auto

```

````auto
     

How can I get the JS to talk to the inline style I have:

```html

````

\<div class=“percent” style=“width: 60%”\>\</div\>

:pope:
