Call Any function/Run any script with Elementor Button

Elementor JavaScript July 23, 2026

Steps:

  1. Add a button and assign a button id. E.g myCustomButton (Must assign from layout not from advanced)
2- Now Find and Copy the function (The function that is required to run the script)
 E.g window.HubSpotConversations.widget.open()
3- Now go to plugins > Add wp code plugin > Header and footer script and in footer part add this script>
<script>document.querySelector('#myCustomButton').addEventListener('click', function() {
   window.HubSpotConversations.widget.open();
});</script>

Or

document.getElementById('myCustomButton')

…. Instead of …..

document.querySelector('#myCustomButton')