+ 1
Possible to get {% block myblock %} in js?
I use a django template with eg {% block myblock %} Can I get that block as an element in js? Eg. var myblock = ??? myblock.html(newHtml)
5 ответов
+ 1
No its not possible but why don't you directly access it with id of a div.
You can put you django block in a div and assign a id to div and use it in your js.
And django variable are meant for server to render the page, I don't think it has any relation with js.
+ 1
AKSHAY🇮🇳 its not actually an issue. I was just curious
0
You can try the answers here:
https://stackoverflow.com/questions/298772/django-template-variables-and-javascript
0
https://code.sololearn.com/WseuLrO5LaXB/?ref=app
0
Justice thank you, but I think the answer is only about how to get django vars in js.