jQuery Back Button

This is a jQuery code snippet to simulate a back button based on the users last web page.


$(function(){}
$('.back').click(function(){
parent.history.back();
return false;
});
});

This will trigger Back button on all elements with the class name “back”. If you would like to specify an element just use the element name

$('#back').click(function()

If you would like to attach the code to only links that has the class name “back”, simply change to

$('a.back').click(function()

Hope this helps

Leave a Reply

Your email address will not be published.