HTML in menu items?

Hi!

I’m currently making a website for my business and I’m not so good at web coding etc.
Instead of going to a specific link, I would like to make the “Contact” menu item do the following:

<a href="#" onclick=“chatShow()” data-event=“Clicked chat from contact page”>YOUR TEXT</a>

chatShow() will open up a chat box plugin on the bottom right of the screen.
I put this accompanying script in the header:

<script>
function chatShow(e) {
tidioChatApi.method(‘popUpOpen’);
}
</script>

The script itself does work, it’s just an issue of making a menu item do it, rather than a text link. Also, I would like to make the call to action button in the slider do the same thing. If we can’t get the menu doing it, then I would at least like the call to action button to do it.

So is there any way to insert HTML into menu items/call to action button? Or am I on the wrong track here?

Thanks.

Hi,

Can you share your site URL here? and please tell me the HTML code that you want to insert to the existing menu/CTA button.

Regards,
Awan

www.lmctapplications.com.au

<a href="#" onclick=“chatShow()” data-event=“Clicked chat from contact page”>Contact Us</a>

www.lmctapplications.com.au

*<a href="#" onclick="chatShow()" data-event="Clicked chat from contact page">Contact Us</a>*

Looks like you didn’t need to put HTML code to the contact menu. You can use the current contact menu and then add this javascript code snippet below:

jQuery('li#menu-item-25 a').click(function(e){
	e.preventDefault();
	chatShow();
})

You can add that code using this plugin: https://wordpress.org/plugins/tc-custom-javascript/

Regards,
Awan

Thanks, Awan, it worked brilliantly!

Any way to make it do the same thing on the call to action button?

Thank you again!

Here is if for the CTA button:

jQuery('.sydney-hero-area a.button-slider').click(function(e){
	e.preventDefault();
	chatShow();
})