title: Hiding flash message after some seconds in codeigniter php
body: <p>Hi i have tried with some script hiding the flash message once it is shown but it is not working.Displaying the flash message until i refresh the page.</p>
  
  <p>Controller:</p>
  
  <pre><code>if ($this-&gt;email-&gt;send())
          {
             $this-&gt;session-&gt;set_flashdata('msg','&lt;div class="alert alert-success text-center" id="successMessage"&gt;Thank you for contacting us we will get back to you soon!&lt;/div&gt;');
              redirect('contact');
          }
          else
          {
              $this-&gt;session-&gt;set_flashdata('msg','&lt;div class="alert alert-danger text-center"&gt;There is error in sending mail! Please try again later&lt;/div&gt;');
              redirect('contact');
          }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>&lt;script&gt;
  $(function() {
  // setTimeout() function will be fired after page is loaded
  // it will wait for 5 sec. and then will fire
  // $("#successMessage").hide() function
  setTimeout(function() {
      $(".alert-success").hide('blind', {}, 500)
  }, 5000);
  });
  &lt;/script&gt;
  &lt;div class="container"&gt;
  
  &lt;div class="row contactpageback"&gt;
  
          &lt;div class="col-lg-6 contactuspagedetails"&gt;
              &lt;form name="contact"  id="contactform" enctype="multipart/form-data" method="post" action="&lt;?php echo base_url();?&gt;contact"&gt;
              &lt;?php echo  $this-&gt;session-&gt;flashdata('msg');?&gt;
              &lt;?php if(isset($msg)){?&gt;
               &lt;?php echo $msg;?&gt;
                 &lt;?php } ?&gt;
  </code></pre>