I am newbie in Webflow, In Webflow project I want to get button by id and execute some Javascript code when I click this button.
The code I write:
<script>
document.addEventListener('DOMContentLoaded', () => {
let btn = document.getElementById('myButtonId');
btn.addEventListener('click', () => {
// handle the click event
console.log('clicked');
alert("Hello");
});
});
</script>
Java script you can call the function any name you want
HTML