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

104
Views
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 answers
Answer question

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