Comment utiliser un masque dans le champ de saisie en JSF 2 + RichFaces 4?

J'ai besoin d'avoir des masques dans mon champs de saisie dans mon formulaire.
J'essaie d'insérer le jQuery.js et jQuery.MaskedInput.js comme le montre le code ci-dessous:

<h:head>
    <h:outputScript name="jquery-1.6.4.min.js" library="javascript" />
    <h:outputScript name="jquery.maskedinput-1.3.js" library="javascript" />

    <script>
        jQuery(function($){
           $("#date").mask("99/99/9999");
           $("#phone").mask("(999) 999-9999");
           $("#tin").mask("99-9999999");
           $("#ssn").mask("999-99-9999");
       });
    </script>

    <title>TITLE</title>
</h:head>

<h:body>
     <h:form id="form">
        <h:inputText id= "date"  />
    </h:form>
</h:body>

Mais rien jusqu'à présent.

Mise à JOUR
Avec BalusC $("[id='form:phone']").mask("(99) 9999-9999"); il fonctionne très bien! (merci mec).
Mais j'ai besoin d'appliquer ce masque dans un datatable :

<script>
    jQuery(function($){
       $("input.phones").mask("(999) 999-9999");
   });
</script>

<title>TITLE</title>
 <h:form id="form">

   <h:panelGrid columns="3">
        <h:outputLabel for="phones" value="Telefone(s) :" />                
        <h:dataTable id="phones" value="#{profile.user.userPhones}" var="item">
            <h:column>
                <h:inputText id= "phone" value="#{item.phone}" />
            </h:column>
            <h:column>
                <h:commandButton value="Remove" action="#{profile.removePhone}"/>
            </h:column>
            <h:column>
                <rich:message id="m_phone" for="phone" />
            </h:column>
        </h:dataTable>
    <h:commandButton value="Add" action="#{profile.addPhone}"/>
   </h:panelGrid>    

</h:form>

Une idée ?

OriginalL'auteur Valter Silva | 2011-10-24