Sometimes we add too much code in a web page and this causes the page to flicker. What it means is that imagine we have created a webpage that needs to show/hide some div part on a user clicking a dropdown.
Once we submit the data to our server (say SQl) the page gets reposted and all elements of default page becomes visible including some content of the page that should not be visible becomes visible for a few seconds.
In order to prevent flickering we can add the below code under tag:
<script type=”text/javascript”>
- document.write('<style type="text/css">body{display:none}</style>');
- jQuery(function ($) {
- $('body').css('display', 'block');
- });

Qhorin HalfhandPosted Feb 1, 2021, 9:29 AM EST
Waste of time
sibadutta NayakPosted Dec 4, 2018, 2:27 AM EST
The above code is not working.
Uday KrishnaPosted Feb 20, 2018, 9:43 PM EST
I mean nothing showing on the screen im getting white page
Uday KrishnaPosted Feb 20, 2018, 9:42 PM EST
When i apply this code complete page is geeting hide