Reputation: 261
I am trying to update the width of a div with a javascript variable but cannot understand how to format it properly.
This way works where you define a fixed percentage.
divider.style.width = '20%';
But I am unable to use a variable like this:
var progress = 40/100;
divider.style.width = progress;
Can anyone point out the proper way to format a float variable into a string that the width property will understand?
Upvotes: 0
Views: 163