Posts Tagged ‘render_template’

[flask] render a template and jump to an anchor

September 6, 2015 Leave a comment

You render a page but you want to jump to an anchor on the rendered page.


Here is a route:

def fn_about():
    return render_template('about.html')

In the view add this (assuming you have jQuery):

<script> $(function(){ window.location.hash = "jump_here"; }); </script>

It’ll run once the HTML is loaded. Found it here.

Categories: flask, python Tags: , ,