# Click to launch chat

**URL:** <https://community.hubspot.com/t/click-to-launch-chat/31143>\
**Category:** Tickets & Conversations\
**Tags:** free\
**Created:** [February 2, 2021, 3:32pm UTC](https://community.hubspot.com/t/click-to-launch-chat/31143 "2021-02-02T15:32:49Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![MatthewShepherd](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/matthewshepherd/32/31314_2.png) [@MatthewShepherd](https://community.hubspot.com/u/MatthewShepherd)\
**Post date:** [February 5, 2021, 10:32am UTC](https://community.hubspot.com/t/click-to-launch-chat/31143/5 "2021-02-05T10:32:25Z")

</div>

Hi @SYeung  
Is the live chat link in your header created as a WordPress menu item? If so it probably won’t provide you with a field where you can add the necessary onclick code. What you can do is [add a class to your menu item](https://sevenspark.com/how-to/how-to-add-a-custom-class-to-a-wordpress-menu-item)and then use Javascript/jQuery to add our desired onclick event to your menu link. For example:

```lia-code-sample
$( ".menu-item" ).click(function() {
 window.HubSpotConversations.widget.open();
});

```

This jQuery code would probably be best placed in your WordPress header.php file.  
If you need some further guidance send me a private message and I’ll see if I can help further.  
Edit:  
For anyone looking to not load their chat widget at all until a button is clicked the above isn’t what you need. Take a look at this post: [https://community.hubspot.com/t5/Tips-Tricks-Best-Practices/onclick-action-doesn-t-work/m-p/457288#M472](https://community.hubspot.com/t5/Tips-Tricks-Best-Practices/onclick-action-doesn-t-work/m-p/457288#M472)

---

_[View the full topic](https://community.hubspot.com/t/click-to-launch-chat/31143)._
