Pages

Monday 23 July 2012

jQuery previous link

Most of the time in our site we need a previous link through that we can navigate in the backward motion. It help us to navigate our visited pages easily. It can also done with the previous button on the browser but if we want to add this previous link to our site it can be done with jQuery very easily. Its simple and yet beneficial. Lets take a look at the code given below


<script type="text/javascript">
$(document).ready(function(){
                         $('a.back').click(function(){
parent.history.back();
return false;
});
});
</script>

Just copy and paste this code in the header section of your page and add code given below at the position where you want to display back link between <body>......</body> tag.

<a class="back" href="#">BACK</a>


No comments:

Post a Comment