Skip to content
Advertisement

Hide div element using python in Flask

I have a div element on ticket.html as <div class="rgrp" style="visibility:hidden">....<div>

So on page /ticket is the form which on submitted redirect to same page as /ticket#

@app.route('/ticket', methods=[POST]
def ticket_display() :
     #now here I want to set visibility visible of that div class```

Advertisement

Answer

In your template for ticket.html you could put something like this:

<div class="rgrp" style="visibility:{{ visibility }}">....<div>

Then when you’re calling your render template, you can do something like this:

return render_template('ticket.html', visibility="hidden" )

If you need to make it visible later, just change the value of the visibility variable you’re passing into the render_template function.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement