Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1019432

    Hi,

    I have a button in my site which is only for clicking to addClass with jQuery.
    Now every time I click the button the page is going to refresh.
    When I set the link manually I want to disable the link wherever on the website.
    I read something about it on the forum but I need to add it in my functions file.

    #1019625

    Hey (Email address hidden if logged out) ,

    Could you please give us a link to your website, we need more context to be able to help you.

    Best regards,
    Victoria

    #1019674

    The only no link I can add to it the button is a #.
    See this topic: https://kriesi.at/support/topic/button-element-with-no-link-not-possible/

    But if I add # as link it jumps to the top of the page when I click the button but I don’t want to.
    When I set the link to manually it refreshes the page but I dont’ want to.
    See the button ‘Meer info +’ on page in private content.

    #1019942

    Hi (Email address hidden if logged out) ,

    Can you please post the JavaScript code that you use to make this button?

    Best regards,
    Victoria

    #1019944

    It is a normal button from the avia builder with class ‘.meer_info_portfolio’
    This is the code in my functions:

    function script_meerinfo(){ 
    ?>
    
    <script>
    jQuery(document).ready(function(){
     
    	jQuery( ".meer_info_portfolio .avia-button" ).click(function() {
      jQuery( ".infoblokportfolio" ).toggleClass( "tonen" );
    });
    });
    
    </script>
    <?php 
    }
    add_action('wp_footer', 'script_meerinfo');
    #1019946

    I already found the solution:

    Added this code to my document ready function:

    jQuery(".meer_info_portfolio a").click(function(event){
    event.preventDefault();
    });
    #1020168

    Hi,

    Great, glad you came up with a solution and thanks for sharing. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.