I have the following question: How does JSF work with JavaScript?
I'll be more specific. I'm working on a project with JSF (primefaces), but I can not seem to do something simple with JavaScript, which would be a
var btnCarregaAnexo = document.querySelector('carregaAnexo')
btnCarregaAnexo.style.display = 'none'
It displays an error in the console, that the btnCarregaAnexo
variable is "null"
.
But in the% w / w I'm trying to get, it has% w / o%
I've also tested with button
, but to no avail ...
So in conclusion, does JSF (primefaces) or JBoss, which I'm using, interfere with ID's path? I can not get a component with JS ...
Thank you, sorry if I did not express myself in the best way, but I am willing to talk.
I changed to perform selection by CSS classes and the error persists ...
XHTML
<p:commandButton id=“carrega1” styleClass="botaoAnexo"
value="Carregar Declaração"
title="Carregar Declaração e/ou Diploma de Conclusão do Ensino Médio"
onclick=“editarArquivo1.show();“
rendered=”#{empty atletaCidadaoController.atletaCidadao.tipoArquivo1}”/>
JavaScript
var btnCarregaAnexo = document.querySelector('botaoAnexo');
btnCarregaAnexo.style.display ='block';
CSS
.botaoAnexo{
display: none;
}
CONSOLE ERROR
Uncaught TypeError: Cannot read property ‘style’ of null