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

89
Vistas
Add html to string svelte

Hey I have a couple strings of text

let text = [
    "<strong>Voiijer</strong>" +
      "is a global community of explorers of all ages who create and share expeditions",
    "Everyone is an explorer, now everyone can explore. Voiijer is for everyone, from students to scientists.",
    "Voiijer is for the naturally curious. <br />To tell the story of the world.",
  ];

that I am displaying like this

<p>{text[index]}</p>

with the index being the index of the carousal element but the html elements are just displaying as text. Anyone have any idea how to fix this?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can show it with {@html text[index]}

However, according to the docs:

Svelte doesn't perform any sanitization of the expression inside {@html ...} before it gets inserted into the DOM. In other words, if you use this feature it's critical that you manually escape HTML that comes from sources you don't trust, otherwise you risk exposing your users to XSS attacks.

You should make sure your string is safe by yourself.

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