Skip to content Skip to sidebar Skip to footer

Call Javascript Function In Jinja For Loop

I have an HTML page, In the variable schedule has sequential decimal number in seconds. My purpose is create a function to convert all these numbers in time using JavaScript/jQuery

Solution 1:

The Jinja code runs on your server. The Javascript runs on the client's browser.

You can't call a javascript function in a Jinja for-loop, because those two things happen at completely different times, on different machines.

The best approach for this scenario is to write a Python function, not a Javascript function, and run it as a filter. You can add a custom filter to the template engine.

Post a Comment for "Call Javascript Function In Jinja For Loop"