In the project I have a file that asks for freight rates and at the same time returns two radio buttons with the freight values. The HTML return is as follows:
<p>
<b>Selecione: </b><br>
<input type="radio" name="tipocep" value="1;40.50" class="seltipocep">
PAC <b>R$ 40,50</b> prazo de 28 dia(s)<br> <br>
<input type="radio" name="tipocep" value="2;129.40" class="seltipocep">
SEDEX <b>R$129,40</b> prazo de 4 dia(s)
<input type="hidden" name="addfrete" value="1"></p>
This HTML content is returned through the following AJAX request:
$("form#consultafrete").submit(function(event) {
/* Act on the event */
event.preventDefault();
<?php if($pagina == 'carrinho'){ ?>
var tipoCEP = 100;
<?php }else{ ?>
var tipoCEP = '';
<?php } ?>
var totalItens = <?php echo $_SESSION['carrinho']['total_itens'] ?>;
var $legendacep = $("#legendacep");
var meucepCalc = $("#seucep").val();
if(meucepCalc != ''){
$legendacep.html("Carregando...");
$.post(
'<?=$siteUrl?>/calcula-frete.php',
{ meucep: meucepCalc, tipo_saida: tipoCEP, qtd: totalItens },
function(data) {
var resultado = '<p>'+data+'</p>';
$legendacep.html(resultado);
});
}
});
What I intend to do is that when the return has radio buttons, when I select one of them, I can do some action, already tried in various ways but it does not work. The fact that it does not work is because the content is dynamic? One of the ways I tried:
$("input[name=tipocep]").change(function() {
alert("sDSDS");
});