Explanation with code :
In this function we have fetched the div element's reference and with this reference we can further call the getAttribute("style") method to have its "style" attribute. Now we can change <div> width by the specified value.
Full html code of the example is as follows :
As you will click on the button "Change Width" it will change the width by the "style" attribute.