title: Getting null value from 'document.getElementById()'
body: <p>I have following confirmation box on <code>review.xhtml</code> page:</p>
  
  <pre><code>&lt;p:confirmDialog message="#{msgs['com.yob.dpg.customerReview.invalid.invoiceDate.message']}" width="400" header="#{msgs['portaal.popup.window.confirmation.title']}" closable="false" widgetVar="invoiceDateConfirmation" showEffect="bounce" hideEffect="explode" severity="alert"&gt;
              &lt;p:commandButton value="#{msgs['portaal.popup.window.cancel']}" onclick="invoiceDateConfirmation.hide()" oncomplete="documentWiz.back(); setFocusToInvoiceNumber()" /&gt; 
              &lt;p:spacer width="5"/&gt;  
              &lt;p:commandButton value="#{msgs['common.ok.button']}" update="messages,@form,headerForm:todoCountMenu,welcomeMessage" onclick="invoiceDateConfirmation.hide()" /&gt;  
  &lt;/p:confirmDialog&gt;
  </code></pre>
  
  <p>and <code>.js</code> is on <code>documentPreview.xhtml</code> page:</p>
  
  <pre><code>function setFocusToInvoiceNumber(){
      document.getElementById("invoiceNumber").focus();
  }
  </code></pre>
  
  <p>input text code on which I want to set focus is on 'documentPreview.xhtml':</p>
  
  <pre><code>&lt;p:inputText  style="color:#4d4d4f; width:280px !important; margin-top: -3px;" id="invoiceNumber" value="#{customerReviewLazyDataModel.customerReviewVO.transactionheaderVO.invoiceNumber}" required="true" requiredMessage="#{msgs['com.yob.dpg.customerReview.mandatory.invoiceNumber']}"/&gt;
  </code></pre>
  
  <p>My problem is that when I click on cancel button of confirmation box, an exception is thrown on browser that 'document.getElementById() is null'</p>
  
  <p>Can any one give me solution for this problem. </p>