Wednesday, 15 May 2013

html - How to convert number to width string property? Javascript -



html - How to convert number to width string property? Javascript -

i trying update width of div javascript variable cannot understand how format properly.

this way works define fixed percentage.

divider.style.width = '20%';

but unable utilize variable this:

var progress = 40/100; divider.style.width = progress;

can point out proper way format float variable string width property understand?

try:

divider.style.width = (progress * 100) + '%';

javascript html css width

No comments:

Post a Comment