Custom jQuery Doesn't Fire

Hello everyone,

I’ve been trying to implement some custom jQuery code, with no luck so far.

My end goal here is to replicate @vincent’s wonderful cookie template.

For some reason, that code doesn’t work (the syntax was a bit off but fixing it didn’t change anything), and neither does even the simplest jQuery function.

Currently, I have a “cookie_banner” section set to display:none. I can’t even get it to be set as display:block by adding this simple function before the </body> tag:

<script>
$(document).ready(function() {
$('.cookie_banner').show();
}
</script>

Webflow should call the latest jQuery library on its own… I also tried calling it myself, just to be sure.

Here is the read-only link for the isolated test site, and here is the public published site. The only custom code I added is what I’ve shown above.


As a disclaimer, I should add that I’m very new to jQuery and js in general, although I’ve had the help of more experienced programmers on this matter. Also, I’m doing this while benefiting from the Lite plan.

Am I missing something? Is this a bug?

Thanks!

Think you just forgot a closing parenthesise, try updating to:

$(document).ready(function() {
  $('.cookie_banner').show();
});

Let me know if that helps :slight_smile:

Best,
Sidney

2 Likes

Thanks @SidneyOttelohe! It works! I don’t know I managed to miss it…

For anyone interested in how I reached the end goal, I’ve scrapped jQuery (since the more complex code wasn’t working regardless, even after fixing the syntax) and I’ve gone for a native Webflow approach.

And it worked! I’ve managed to make a section appear only upon the absence of a cookie (and then making the cookie appear and expire as needed), using the code I found here.

This topic was automatically closed 125 days after the last reply. New replies are no longer allowed.