Calling JQUERY function with Primefaces

Asked

Viewed 1,445 times

0

I want to run a Jquery call after the click of a button:

<p:commandButton id="btnSelecionaLote" icon="ui-icon-pencil" action="#{loteController.selecionarLote()}">
    <f:setPropertyActionListener value="#{lote.id}" target="#{loteController.loteBean.id}"></f:setPropertyActionListener>
</p:commandButton>

Jquery

function testePrime(){
        $("#formLote\\:btnSelecionaLote").click(function() {
            alert("testing!");
        });
}

2 answers

0

  • didn’t work :|

  • You are placing this HTML code within this scope: $(Document). ready(Function(){....})

  • yes yes it does not work :|

  • I don’t know if you noticed but you’re using native html I’m using primefaces

  • turns on it’s generating this when inspecting element id = j_idt7:formLote:j_idt46:0:btnSelectionLote

  • 1

    I solved with this onclick="jQuery(Primefaces.escapeClientId('tabelaRaca')). Hide()"

  • Post the answer so we can close the question

Show 2 more comments

0


I solved the problem with the following code:

onclick="jQuery(PrimeFaces.escapeClientId('tabelaRaca')).hide()"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.