Send user back to previous page with text link


#1

I’d like to add a text link on my page that would send the visitor back to their prior page – same functionality as hitting the “back” button in your browser.

I found this old thread, but it’s for adding this functionality to a button, not a text link: Back buttons

Would appreciate any help on how to do this – thanks!


#2

Hey @Andy2

The solution given in that thread should still work for your needs! The only thing that you’ll need to change is the selector:

<script>  
jQuery(function() {  
  jQuery("YOUR_TEXT_LINK_ID_HERE").click(function() {  
    history.go(-1);  
    return false;  
  });  
});  
</script>

You can find the selector at the bottom of the Properties panel for the text block that you want to have linked (click the image below to see what I’m talking about):

Let me know if that works out for you. :slight_smile:


#3

Thank you @leah.ann! For the selector, do I include the pound/hash symbol at the beginning? And, do I keep the quote marks around it?


#4

No problem! And yes to both questions. :slight_smile: So if I was going to use the selector from the screenshot, the final code would be this:

<script>  
jQuery(function() {  
  jQuery("#lp-pom-text-49").click(function() {  
    history.go(-1);  
    return false;  
  });  
});  
</script>

#5

Thanks very much, I think I’ve got it!