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

112
Visualizações
Running out of quotation marks. (Django statics with document.write)

This element:

<img id="img" src="{% static 'pd.jpg' %}" />

should go here:

popup.document.write("<img src={% static 'pd.jpg' %} />")

So think i need a third kind of quotation marks, or ?

popup.document.write(String(<img src="{% static 'pd.jpg' %}" />))

at least is not working.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

So think I need a third kind of quotation marks, or ?

No: the template tags are resolved when the template is rendered. This is done by the server. JavaScript on the other hand will run by the browser, and after the template is rendered. You thus can make use of:

popup.document.write('<img src="{% static 'pd.jpg' %}" />')

The single quotation marks of the {% static 'pd.jpg' %} will thus not appear in the source of the page (which you can inspect in the browser).

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