Button link for javascript code stopped working

On button click, against link: we had this:
JavaScript:handleClick();

and I defined handleClick on global CSS/JS section
function handleClick() {
// code
}

The code was working earlier. somehow the javascript function has stopped getting triggered. on clicking the button, the same page gets refreshed and not the javascript code. Kindly help.

I recently updated my wordpress version. Can it be due to this or any other issue?

It was actually a security fix we added back in Febuary.

You can read about ways to get around it here:

So what is the recommended option to enable dynamic link on button click?
Basically I’ve used beaverbuilder for a landing page. I have google ads that go to this page. I have written some custom JS function to pass on the google ad parameters from this page to my actual sign up page. so basically i change the window.location from current page to a new page but passing the “?” params that helps google ads track conversions.

The second block of code in the post I linked to will disable that WP security feature and allow you to use javascript in links.

We obviopusly dont reccomend disabling security features. The correct way to use GTM and track clicks is to either add the correct location for the button in the GTM control panel or alternativly write a snippet of JS to watch the button and when its clicked to do your GTM code to track the click.

An example of using JS to track a button click, which is the correct way to do it would be something like this example from 9 years ago

In your instance you could add a class to your button module like onclick then your JS could be something like this

jQuery(document).ready(function() {
  jQuery(".onclick a").on("click", function( e ) {
    e.preventDefault();
    //
    // code to be executed here
    //
  });
});