Add onlick to button
Hi
I have this page which is currently hidden the website:
I want a way of pressing the button will do the action i need, which is open the chat module.
- If i had HTML module with this code: <h2 class="chat" onclick="chatButton.onClick();">Start chat</h2>
Then it will appear there the text Start Chat, if i press the chat will pop up.
But I wanted to do it with the button option.
How should i do it?
I tried to insert this on the LINk "chatButton.onClick()" but didn't work.
Comments
Hi,
When you add a button element and scroll to the bottom of its settings, you will find the Onclick field where you can add this:
Best regards
So, it kind of works but not perfect.
Because page is refreshing and then chat closes.
I recorded video with all options and opened page (DEV WEBSITE).
LINK: https://www.dropbox.com/scl/fi/5yh8w76bv3e4p5wqm0gbn/Grava-o-do-ecr-2024-12-20-s-10.15.22.mov?rlkey=ivyui93rjcyyzg33i7su52jan&dl=0
1 - You see that before button I have a version with custom HTML and code, if I press that on the front page, the page IS NOT reloading and works fine
2- With button module you see that page is refreshing after 0,5 second and chat closes.
How can i fix that?
Please attach a link to your website so we can check it out. If the page is offline(localhost), then our help will be limited. You will have to contact us when the page is online. Also, please make sure that the page is not under maintenance before you provide us with the link.
Thanks
Here you have
https://ps5digital.pt/suporte/
The button with code as you said onlick
And that "START CHAT" is the HTML mode I've shown on video.
Try the solution provided here:
https://www.sitepoint.com/community/t/getting-link-to-stay-in-same-place-when-clicked-not-jump-to-top-of-page/1788/2
Best regards