Adding second on.("click") event on page
-
Hi Guys,
Just a quick question regarding adding a second link click using Jquery. As I recently found out that onclick="open('link')" does not work in IE or Microsoft Edge, I am trying to replicate this using Jquery. The onclick option works perfect on everything else however I ideally need this to work across all browsers.
My issue is that this link sits within an accordion and so when the accordion is activated, the link within it is showing up when you hover over it however when you click on it, it just does not load and produces an error in inspector.
The link is here - the example is on the first drop down and the second 'book now' link.
My CSS for the 'book now' link is:
jQuery(document).on("click", ".book", function(e) {
e.preventDefault();
var id = jQuery(this).attr('href');
});And the HTML for the 'book now' link is
<a href="https://www.onetournament.uk/booking-form" class="book">Book now</a>
As always any help would be massively appreciated.
Cheers
Chris
-
-
Hi @mariusjopen
I have tried just a normal link however I have the same problem where it will show it is a link, however when you click on it, it does nothing and I get errors in inspector. I'm presuming this is because they are within the accordion?
The below image is the error I'm getting if its any help?
Cheers
Chris
-
-
Of course you will still need to adjust the jQuery to the Laytheme:
http://laytheme.com/documentation.html#custom-javascriptBest!
Marius
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it