I'm using a platform that only allows me to add script tags to add any javascript. In this case I'm using a Zendesk widget for customer service. I wanted to have this widget controlled also through a nav link, where I click the nav link and the widget's contact form toggles between being opened and closed.
<!-- Start of Zendesk link action -->
<script type='text/javascript'>
document.evaluate("//a[contains(., 'Contact Us')]", document).iterateNext().addEventListener("click", function(){
console.log('this is working good!!!!!!!');
zE('webWidget', 'toggle');
}, true)
</script>
<!-- End of Zendesk link action -->
My issue is while the page is in mobile view the nav bar changes from a nav bar to display the links to using a modal to display the nav links but while clicking the same link in the modal the onclick event doesn't respond.