Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

90
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda