Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

207
Vistas
Adding an onClick event to an svg element in a java script class

I'm trying to add an onClick event to an svg tag where i want it to direct me to another page which is page2.html. I really tried everything but I couldn't find a solution. If there is another way of doing that other than using onClick would be great as well3 Would really appreciate the help. Here is my code:-

import React from "react";
import "./HeaderBox.css";
import "./HeaderBox.scss";
import { Card } from "react-bootstrap";

const HeaderBox = () => {
  return (
    <Card id="Header">
      <button>page</button>
      <div class="HeaderDiv">Omar Fares</div>
      <svg viewBox="45 60 400 320" xmlns="http://www.w3.org/2000/svg">
        <path
          fill="#fff"
          d="M 90 210 C 90 180 90 150 90 150 C 150 150 180 150 180 150 C 180 150 300 150 300 150 C 300 150 330 150 390 150 C 390 150 390 180 390 210 C 390 240 390 270 390 270 C 330 270 300 270 300 270 C 300 270 180 270 180 270 C 180 270 150 270 90 270 C 90 270 90 240 90 210"
          mask="url(#knockout-text)"
        ></path>
        <mask id="knockout-text">
          <rect width="100%" height="100%" fill="#fff" x="0" y="0" />
          <text x="147" y="227" fill="#000">
            Memory
          </text>
        </mask>
        <a onClick="window.location.href='page2.html'"></a>
      </svg>
      
    </Card>
  );
};
export default HeaderBox;
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In React, you need to assign a function to onClick

 onClick={() => window.location.href='page2.html'}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda