diff --git a/typo3/sysext/backend/Classes/Controller/ContentElement/NewContentElementController.php b/typo3/sysext/backend/Classes/Controller/ContentElement/NewContentElementController.php
index 07e42e8ff3e0ccd80ec9b6d665680407a1636e93..d0867a5ab66303f12e3ad6db2c04e1aaa63569f6 100644
--- a/typo3/sysext/backend/Classes/Controller/ContentElement/NewContentElementController.php
+++ b/typo3/sysext/backend/Classes/Controller/ContentElement/NewContentElementController.php
@@ -266,7 +266,10 @@ class NewContentElementController
             $cc = ($key = 0);
             $menuItems = [];
 
-            $this->view->assign('onClickEvent', 'function goToalt_doc() { ' . $this->onClickEvent . '}');
+            $this->view->assignMultiple([
+                'hasClickEvent' => $this->onClickEvent !== '',
+                'onClickEvent' => 'function goToalt_doc() { ' . $this->onClickEvent . '}',
+            ]);
 
             foreach ($wizardItems as $wizardKey => $wInfo) {
                 $wizardOnClick = '';
diff --git a/typo3/sysext/backend/Resources/Private/Templates/NewContentElement/Main.html b/typo3/sysext/backend/Resources/Private/Templates/NewContentElement/Main.html
index ef12a94890e5f9b67d0815ce3d9d0f810a0fe2a8..713f7fa2855add45057645f064c5d9a714d62c15 100644
--- a/typo3/sysext/backend/Resources/Private/Templates/NewContentElement/Main.html
+++ b/typo3/sysext/backend/Resources/Private/Templates/NewContentElement/Main.html
@@ -3,7 +3,7 @@
     <f:then>
         <f:form action="" name="editForm" id="NewContentElementController">
             <f:form.hidden name="defValues" value="" />
-            <f:if condition="{onClickEvent}">
+            <f:if condition="{hasClickEvent}">
                 <f:then>
                     <script>
                         {onClickEvent -> f:format.raw()}