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

224
Vistas
React - Calling a function from content management system html

I have an odd case that I need to solve. I have a react app that dynamically injects html content via (dangerouslySetInnerHTML={{__html: data}}). Think of it as a pseudo content management system with some legacy html content with some embedded javascript method calls, so I can't change the follling html block.

Example embedded html block (injected using dangerouslySetInnerHTML):

<p><a href="javascript:showvideo('http://urldir/vid.mp4',vwidth,vheight,0)">Launch vid.</a></p>

in my react component:

function showvideo(url,width,height,id){
  console.log('called showvideo')
}

I keep getting 'Uncaught ReferenceError: showvideo is not defined'

How do I call a function with <a href='javascript:myfunction'> in react?

about 4 years ago · Juan Pablo Isaza
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