【发布时间】:2016-03-13 12:24:17
【问题描述】:
当我使用 (.load()) 重新加载 DIV 中的内容时,我的网站出现问题 单选按钮不运行 onchange 事件我该如何解决?
$(window).ready(function(){
$('input[name="optionsRadios"]').on('change', function(){
if ($(this).val()=='veloce') {
//change to "show update"
var senzasped = <?php echo $tot; ?>;
senzasped += 5;
$("#prezzotot").text(senzasped);
$("#spedizionese").text("Spedizione Veloce");
$("#spedizionese2").text("5,00€");
} else {
var senzasped = <?php echo $tot; ?>;
senzasped += 3.5;
$("#prezzotot").text(senzasped);
$("#spedizionese").text("Spedizione Normale");
$("#spedizionese2").text("3,50€");
}
});
});
HTML:
<div class="modal-sped" style="width:100%; height:100px">
<div class="row">
<div class="col-md-12" style="margin-left:20px">
<label>Selezione la spedizione: </label>
<div class="radio">
<label>
<input type="radio" name="optionsRadios" id="optionsRadios1"value="normale" checked>
Spedizione Normale 3,50€
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="optionsRadios" id="optionsRadios2" value="veloce">
Spedizione <strong>Veloce</strong> 5,00€
</label>
</div>
</div>
</div>
</div>
【问题讨论】:
标签: javascript jquery html