swoopnebula Posted August 5, 2021 Posted August 5, 2021 Site URL: http://www.thevisualpharmacy.com Hey All, I have a custom button that I have created for my products page that links off to an external site for people to purchase from. I have hidden the original purchase button and I am styling the new link using CSS to target the link. I am now trying to add a class to the URL Link using JQuery but I can't seem to get it right. I stumbled upon this code snippet here but upon using inspect element It doesn't show that the class has been added. $(function(){ var cUrl = window.location.href; $("a").each(function(){ if ($(this).attr("thevisualpharmacy.gumroad.com/l/nintendo64mockup") == cUrl){ $(this).addClass(“gumroad-button”-); } }); }); I have loaded the JQuery Library, I am not an expert at JQuery by any means. Any insight to this is helpful. Thank you guys.
tuanphan Posted August 8, 2021 Posted August 8, 2021 this has an invalid symbol, try this ("gumroad-button") Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.