2
Good morning, I am developing a project where I made a small function where I will change all the items except what was selected, but this item still ends up being changed.
HTML:
<div class="col-xs-12" style="margin: 20px 0 0 0; padding: 0;">
<div class="col-xs-6 col-sm-6" style="padding-left: 0;">
<a class="btn cadastro btn-inscricao" href="Javascript:void(0);" <?= $total_intervalor ? '' : 'disabled';?> onclick="informeCnpj()">
<div>
<span>Inscrever o projeto de sua Entidade</span>
</div>
<div>
<img src="images/arrow-right.png">
</div>
</a>
</div>
<div class="col-xs-6 col-sm-6" style="padding-right: 0;">
<a class="btn cadastro btn-feedback" href="Javascript:void(0);" onclick="informeCnpj()">
<div>
<span>Enviar feedback após o evento</span>
</div>
<div>
<img src="images/arrow-right-white.png">
</div>
</a>
</div>
</div>
Script:
<script>
function informeCnpj() {
$('.informe-cnpj').slideDown(400);
$(this).css('opacity', '1');
$('.cadastro:not(this)').css('opacity', '0.5');
}
</script>
Dude is very confused your question, what do you really want to do?
– LeAndrade
@Leandrade has these 2 buttons, the Registration button, and the Feedback button. For example clicking on either of the two will call this function "informeCnpj" which shows a hidden div, and decreases the opacity of the opposite button. But when clicking for example on the Signup, only the feedback should be 0.5 opacity, but both (Signup and Feedback) are with this opacity.
– Alex Borgmann
Would not be
$('.cadastro').not(this).css('opacity', '0.5');
??– fernandosavio
@fernandosavio Still it touches the opacity of both, instead of only 1.
– Alex Borgmann
But this code should be inside an event Handler, otherwise the
this
will not be the element you want– fernandosavio
@fernandosavio as well?
– Alex Borgmann
Behold that example
– fernandosavio