//If click() function isn't working; var targBtn = document.querySelector ("#create"); var clickEvent = document.createEvent ('MouseEvents'); clickEvent.initEvent ('click', true, true); targBtn.dispatchEvent (clickEvent);