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

107
Vistas
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 Respuestas
Responde la pregunta

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 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