[Django]-Django templates – passing variables between templates

5πŸ‘

βœ…

I found using this worked for my purposes:

page1.html:

...
{% for element in someList %}
    {% include "popup.html" with element=element %}
    <div class="col s3 some-button"><a onclick="$(showPopup('popup'));">More Info</a></div>
{% endfor %}
πŸ‘€user2424607

0πŸ‘

In your link you can add an attribute data-element="{{ element }}" and in the onclick method associated with the link you can retrieve the value like this:

var el = $(this).data("element");

Now, pass el to your popup.

πŸ‘€ettanany

Leave a comment