DEV Community

desertlion
desertlion

Posted on

Qiscus Chat Widget: Use a Custom Trigger Button

Qiscus Widget already give you a trigger button like shown below:
trigger button

But if you ever have a case where you need to use your own button, you could do that by following this procedure:

  • We need to hide the original qiscus button
<style>
.qcw-trigger-btn { display: none !important; }
</style>
  • We need to have the replacement button trigger the click event for the original hidden button.
<script>
document.getElementById('my-button-id')
   .addEventListener('click', function() {
      document.querySelector('.qcw-trigger-btn').click();
});
</script>

If you need a working example, refer to this codesandbox.

Top comments (0)