Svg line pls help set attribute | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Svg line pls help set attribute

IHelp me make polyline at svg please. I try to set points of polyline but el.style.points="0 0 9 9" doesn't work How to make with no el.setAttribute() https://code.sololearn.com/WMRXG0zXdyps/?ref=app

20th Apr 2022, 11:39 AM
Ashas Yiksvorogom
Ashas Yiksvorogom - avatar
2 Answers
+ 2
Hi Ashas Yiksvorogom , if you use: console.log(JSON.stringify(el.style)) You will see that this style object don't have the "points" property. That why you can not set the ponits using "el.style". The question is why you don't want to use the setAttribute() method for this?! According to: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/points points is an "Attribute", so obviously you need to use setAttribute() to set it!
23rd Apr 2022, 3:41 AM
Thống Nguyễn
Thống Nguyễn - avatar
0
Thank
18th Jul 2022, 12:26 PM
Ashas Yiksvorogom
Ashas Yiksvorogom - avatar