-2
I am doing an event in js, but the same is not working properly by the following fact if the user does not select at least one radio he does not trigger the event, as he would for the event to function as radio had in checked ??
<div class="radios-group">
<label>Forma de pagamento:</label><br>
<?php if ($dados->atendimento_anotacoes <> null) {?>
<div class="custom-control custom-radio">
<input type="radio" id="dinheiro" name="forma-de-pagamento"
class="custom-control-input" checked>
<label class="custom-control-label" for="dinheiro">Dinheiro</label>
</div>
<?php }else{ ?>
<div class="custom-control custom-radio">
<input type="radio" id="cartao_debito" name="forma-de-pagamento"
class="custom-control-input" checked>
<label class="custom-control-label" for="cartao_debito">Cartão Débito</label>
</div>
<div class="custom-control custom-radio">
<input type="radio" id="cartao_credito" name="forma-de-pagamento"
class="custom-control-input">
<label class="custom-control-label" for="cartao_credito">Cartão Crédito</label>
</div>
<?php } ?>
</div>
$(function () {
$('.radios-group').find('input:radio').click(function () {
var url = this.id;
$(this).closest('form').prop('action', 'process/' + url + '.php');
});
});
If you explain better there’s no way to help, I don’t understand what you want to do.
– Vinicius De Jesus