why can't i change the width of the rect in svg? html and javascript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

why can't i change the width of the rect in svg? html and javascript

why can't i change the width of the rect in svg? i wrote these lines of code: in js file: window.onload=function() { var bone = document. getElementById("building"); bone. width="50"; } ; in html: i defined the script of java <rect id="building" width="100" height="150" x="0" y="150" /> the html code works it just doesn't change the width..

30th Sep 2018, 8:04 PM
Majd
Majd - avatar
2 Answers
+ 1
how can i use the dom with the svg, what should i do?!
1st Oct 2018, 8:14 AM
Majd
Majd - avatar
0
dom doesn't have width property
30th Sep 2018, 9:17 PM
Toni Isotalo
Toni Isotalo - avatar