-1
I need to do a check before changing html elements, I tried this way but it did not work does not enter if in any circumstances.
<script>
if("<?php empty($usuario_pesquisado->getArea()->getNome()) ?>")
{
$('#area_item').css("opacity", 0.4);
}
if("<?php empty($usuario_pesquisado->getFormacao()) ?>")
{
$('#formacao_item').css("opacity", 0.4);
}
</script>
Use the condition in PHP, if the result is true, you print the JS code with the
echo
. If your PHP is version 7+, use<?php echo (!empty($usuario_pesquisado->getArea()->getNome())) ?: '$('#area_item').css("opacity", 0.4);' ?>
– Valdeir Psr
Yes php use 7, unfortunately it didn’t work :/
– Reignomo
uses the
if
. Basis: http://codepad.org/Bc75rDMf– Valdeir Psr
vlw friend, now it worked :D
– Reignomo