Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

105
Views
Quedarse sin comillas. (Django estático con document.write)

este elemento:

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

debería ir aquí:

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

Entonces, ¿creo que necesito un tercer tipo de comillas, o?

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

al menos no funciona.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Entonces, ¿crees que necesito un tercer tipo de comillas, o?

No : las etiquetas de la plantilla se resuelven cuando se representa la plantilla. Esto lo hace el servidor. JavaScript, por otro lado, se ejecutará en el navegador y después de que se represente la plantilla. Por lo tanto, puede hacer uso de:

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

Las comillas simples de {% static 'pd.jpg' %} no aparecerán en el código fuente de la página (que puede consultar en el navegador).

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!