Here I will explain how to refresh page in jQuery or reload page in jQuery or refresh or reload webpage using jQuery.
Description:
In previous articles I explained jQuery set some time delay for function execution, jQuery keypress keydown and keyup events example, jQuery hide div element after 5 seconds, jQuery Remove first/last character from string, jQuery create rounded corners for textbox and many articles relating to JQuery. Now I will explain how to refresh or reload page using jQuery.
In previous articles I explained jQuery set some time delay for function execution, jQuery keypress keydown and keyup events example, jQuery hide div element after 5 seconds, jQuery Remove first/last character from string, jQuery create rounded corners for textbox and many articles relating to JQuery. Now I will explain how to refresh or reload page using jQuery.
To refresh or reload webpage in jQuery we need use location.reload() for that need to write code like as shown below
<script type="text/javascript"> $(function() { $('#btnClick').click(function() { location.reload(); }) }) </script> |
If you want see it in complete example need to write the code like as shown below
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>jQuery Refresh or Reload web Page</title> <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script> <script type="text/javascript"> $(function() { $('#btnClick').click(function() { location.reload(); }) }) </script> </head> <body> <div> <input type="button" id="btnClick" value="Refresh" /> </div> </body> </html> |
Live Demo
No comments:
Post a Comment