title: Updating Primefaces Component Value with function in javascript
body: <p>i want to update my component value evry 10 keyup , so I wrote the following code :</p>
  
  <pre><code>&lt;h:body&gt;
     //***************************JAVAScript function**************
  &lt;SCRIPT LANGUAGE="JavaScript"&gt;
   function fnc(){
                  length=document.getElementById("aa").value.length;
                   if(length == 10)
                                  {
                          document.getElementById("aa").value ="";
  
                                  }
  
                  }
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;ui:composition template="commonLayout.xhtml"&gt;
  
      &lt;ui:define name="content"&gt;
          &lt;section id="main" class="column"&gt;
          &lt;h4 class="alert_info"&gt;Scannez les bonbonnes puis cliquez sur
              enregistrer :&lt;/h4&gt;
          &lt;div class="Saut20px"&gt;
  
              &lt;h:form id="form"&gt;
                  &lt;p:panel id="panel" header="Register"&gt;
  
                      &lt;br /&gt;
                      &lt;p:focus context="panel" /&gt;
                      &lt;p:growl id="msgs"&gt;&lt;/p:growl&gt;
  
  
                      &lt;h:outputLabel value="Code Barre :" /&gt;
  
    //*****************call function in onComplete******
     &lt;p:inputText id="aa" value="#{bonBonneManagedBean.sel}"&gt;
                          &lt;p:ajax event="keyup" update="koko msgs" oncomplete="fnc()"
                              listener="#{bonBonneManagedBean.ajouterSelected(bonBonneManagedBean.sel)}" /&gt;
                      &lt;/p:inputText&gt;
  </code></pre>
  
  <p>But the call does not work , if you can help me find the error, thank you in advance</p>