+ 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.
3 Antworten
+ 3
Use this snippet.
var height = document.querySelector(ELEM_NAME).style.height
+ 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/
+ 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