Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

198
Views
No se puede agregar mediante programación el elemento <line> dentro del elemento <g>

Estoy tratando de crear un elemento <line> y agregarlo a un elemento <g> . Cuando lo hago a través de HTML, funciona:

 <svg> <g id="graph-paper"> <line class="lineStyle" x1="0" y1="0" x2="100" y2="100"></line> </g> </svg> <style> .lineStyle { fill: none; shape-rendering: crispEdges; stroke: black; stroke-width: 1px; } </style>

Pero cuando trato de agregarlo con javascript, no lo hace:

 let graphPaper = document.getElementById("graph-paper") let line = document.createElement("line") line.setAttribute("x1", "0") line.setAttribute("x2", "20") line.setAttribute("y1", "40") line.setAttribute("y2", "80") line.setAttribute("class", "lineStyle") graphPaper.appendChild(line)

¿Qué estoy haciendo mal? Quiero hacerlo con javascript.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!