Tagged: Button Link
-
AuthorPosts
-
October 9, 2018 at 11:53 am #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.October 9, 2018 at 7:20 pm #1019625Hey (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,
VictoriaOctober 9, 2018 at 9:43 pm #1019674The 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.October 10, 2018 at 1:48 pm #1019942Hi (Email address hidden if logged out) ,
Can you please post the JavaScript code that you use to make this button?
Best regards,
VictoriaOctober 10, 2018 at 1:54 pm #1019944It 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');October 10, 2018 at 2:00 pm #1019946I already found the solution:
Added this code to my document ready function:
jQuery(".meer_info_portfolio a").click(function(event){ event.preventDefault(); });October 11, 2018 at 5:36 am #1020168 -
AuthorPosts
- You must be logged in to reply to this topic.
