Adding buttons to your website makes navigation easier for visitors, including adding or creating a button to return to the previous page.
If you use WordPress and the Elementor plugin as your page builder, you can create a back button with Elementor without needing the paid version of the plugin, which will be discussed in this article.
How to Create a Back Button with Elementor
To do this, you must have the free or paid version of the Elementor plugin installed on your website, and ensure you understand the basics of using Elementor, such as adding specific elements.
If those two basic requirements are met, you can proceed to the steps for creating a back button with Elementor below:
1. Create the Button
The first thing you need to do is add a new button with Elementor, then in the Link option, leave it as a hash (#), and fill in the Text with whatever text you want to display.
Next, open the Advanced tab while editing the button, and in the CSS Classes field, assign a class named tombol_kembali
2. Add Custom HTML
Now you can add custom HTML at the very end of the page or post you are creating to add a script that returns to the previous page.
After adding the custom HTML block, add the following line of code.
<script>document.addEventListener('DOMContentLoaded', function () { let backButtons = document.querySelectorAll('.tombol_kembali'); backButtons.forEach(function (backButton) { backButton.addEventListener('click', function (e) { e.preventDefault(); history.back(); }); });});</script>Once added, you can now save your post or page and test the button you just created.
3. Test the Button
To test it, try opening the page that has the back button from another page, such as your website's homepage.
If successful, the result will look like this.
That is the easy way to create a back button with Elementor, and you certainly do not have to use Elementor Pro to create this button.
If you are interested in creating other buttons in Elementor, you might also be interested in this tutorial: How to Create a Back to Top Button in Elementor.
COMMENTS
Loading...