Javascript onclick display multiple SVGs -


i trying display multiple svg paths after clicking on svg polygon. able , individual path appear onclick using

document.getelementbyid(id).style.display = "block"; 

getelementbyid() on works 1 path though. how can onlclick work multiple paths?

i tried using loop getelementsbyname(id) plunker here: http://plnkr.co/edit/5u16eptq1ymsleuvlya5?p=preview

thanks help!

all id attributes in document must unique , can't use name attributes in svg leaves classes.

replacing id attributes class

<path class ="test-arrow" d="m 1020 290 c1020,40 825,40 765,100" style="display: none; stroke: black; stroke-width: 5px; fill: none; marker-end: url(#markerarrow);"/> <path class ="test-arrow" d="m 960 385 c920,450 775,550 775,370" style="display: none; stroke: black; stroke-width: 5px; fill: none; marker-end: url(#markerarrow);"/> 

and using getelementsbyclassname name fixes things.

here's updated plunk


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -