Need button click to change link without reloading website instance..

[ad_1]

For a car rental website, there will be 4 vehicle color option buttons. Clicking one of these should change the hyperlink address in the “Book Now” button. Im trying to do this without having to reload the whole page everytime. Is this possible on WordPress/ Elementor?

[ad_2]
2 Comments
  1. I don’t know about elementor I doubt it’s an out of the box solution but it can be achieved with some Javascript. Essentially the colour choices would have click events on them that modify the href attribute if you book button.

  2. Basically you need this kind of thing:

    <script type=”text/javascript”>
    jQuery(document).ready(function(){
    jQuery(‘#somebutton’).click(function(){
    jQuery(‘.a_target_element’).html(‘The new content such as a URL’);
    });
    });
    </script>

    Add it to the footer, or drop it in a code block on the page… set #somebutton to the ID of your colour selector… set .a_target_element to the class (or #target ID) of your button with the URL.

    This changes the HTML content… I don’t know how your stuff is done, so you may need to modify it.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer