+ 1

How to use variable in style property of bar graph

Hello, I am doing bar graph in html.. for graph, height is set by style =" height = 90%"... I need this 90 value as variable and need your help to achieve the same as I am unable to do so... for more info, I am trying to create graph from XML data and that height value to be stored in variable is from XML.

4th Dec 2018, 3:11 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
3 Respuestas
+ 3
Use this snippet. var height = document.querySelector(ELEM_NAME).style.height
4th Dec 2018, 1:23 PM
Seniru
Seniru - avatar
+ 2
You can just use this. document.queryselector(OTHER_ELEM).style.height = height //you need previous snippet to wok this. I recommend you to go through this tutorial. https://www.sololearn.com/learn/JavaScript/2752/
5th Dec 2018, 11:55 AM
Seniru
Seniru - avatar
+ 1
Seniru Pasan, this means value of element height is stored in variable....correct.? now what to be done if I wanna set this variable value as height of another element
5th Dec 2018, 3:07 AM
Ketan Lalcheta
Ketan Lalcheta - avatar