Skip to content Skip to sidebar Skip to footer

Adding Jinja Template Dynamically

I have a jinja template that is the only content inside a set of div tags.
{% include 'temppage.html' %}
When I press a button, I want t

Solution 1:

You could use a JS framework (such as Angular, React...) in order to achieve this...I am assuming you are trying to build a single page app?

Otherwise, you will have to rely more on Javascript in order to change the HTML under you div depending on what you click. For example, if you have button 1, 2, 3. Each rendering a different HTML template upon clicking.

Example (using jQuery):

$(document).on('click', '.some-class', function() {
    document.getElementById("section0").innerHTML = "something";
});

fyi: "something" can be an html structure.

Post a Comment for "Adding Jinja Template Dynamically"