0

I need get an id of a inputText that is inside a p:dialog. I tried this way but nothing happened. Can anyone helpe me?

<h:form id="form">                    
<p:dialog header="Telefones" widgetVar="telefoneDialog" modal="true" showEffect="explode" hideEffect="explode" resizable="false">
    <p:outputPanel id="empresaTelefoneDialog">
            <p:panelGrid columns="3">
                <p:outputLabel for="tipoTelefones" value="Tipo "/>
                   <p:selectOneMenu id="tipoTelefones" value="#{empresaBean.telefone.tipo}">
                            <f:selectItem itemLabel="Fone 2" itemValue="Fone 2"/>
                            <f:selectItem itemLabel="Celular 2" itemValue="Celular 2"/>                        
                        </p:selectOneMenu>
                        <p:inputMask id="telefoneMask" mask='99-9999-99-99' value="#{empresaBean.telefone.telefone}"/>  
                        <h:commandButton value="Add" action="#{empresaBean.addTelefone()}"/>
            </p:panelGrid>
    </p:outputPanel>
</p:dialog>

$(document).ready(function(){

  $('#form\\:telefoneMask').click(function(){

  console.log("TESTE");
 });

});

1 Answers1

0

Try with this

$(document).ready(function(){
    $("#form input[id*='telefoneMask']").click(function(){
    console.log("TESTE");
});

This should return an input element, containing "telefoneMask" as part of the id attribute.

AlkaRocks
  • 81
  • 1
  • 4