how to trigger a function in javascript on click code example Example: javascript trigger click on element document.getElementById('myElementID').click();