事件触发器似乎不起作用。这是我的代码:
{% for DepartureDate, LfidElement in Flight%}
var DepartureDateCurrentVol = "{{DepartureDate}}";
var weekDayRange=new Date(DepartureDateCurrentVol).getDay();
weekDayName=returnWeekDayName(weekDayRange);
{% for LFID, VarTypeElement in LfidElement %}
{% for VarTypeID, FareInfosElement in VarTypeElement %}
{% for FareId,FareInfo in FareInfosElement.FareInfos %}
var flagMin = "{{ FareInfo.FlagMinAmt|e }}";
var amountCurrentVol="{{ FareInfo.BaseFareAmtInclTax|e }}";
var fareIdDeparture="{{FareId}}";
if(DepartureDateCurrentVol == dateDepartureRequest)
{
moinsCherArrivalSelected=0;
montantGlobal+=parseFloat(amountCurrentVol);
dateDepartureRequestedFound=1;
$('#aller').append('<div class="v2_blocselectionorange"><div class="v2_blocselectionorangehaut">'+weekDayName+'<br />'+DepartureDateCurrentVol+'</div><div class="v2_blocselectionorangebas">à partir de <br /><span class="v2_prixselection">'+amountCurrentVol+' dt</span><div class="v2_prixselectionradio"><input type="radio" id="selectionr'+fareIdDeparture+'" name="selectionr" value="1" checked="checked"></div></div></div>');
volSelected['Departure']=fareIdDeparture;
$('#retour').empty();
//$("#selectionr"+fareIdDeparture).change();
$("#selectionr"+fareIdDeparture).trigger("change");
}
$("#selectionr"+fareIdDeparture).change(function(){
var idFareIDCurrent=$(this).attr('id').substring(10);
FareInfo=idFareIDCurrent;
{% for key,pas in FareInfo.ReturnFlightSegmentDetails%}
var arrivalDate="{{key}}";
var weekArrivalDayRange=new Date(arrivalDate).getDay();
weekArrivalDayName=returnWeekDayName(weekArrivalDayRange);
{% for key2,ReturnFlightSegmentDetailsInfosValue in pas %}
{% for key3,ReturnFlightSegmentTypeInfo in ReturnFlightSegmentDetailsInfosValue %}
{% for key4,ReturnFlightSegmentInfo in ReturnFlightSegmentTypeInfo %}
var amountArrivalDate="{{ ReturnFlightSegmentInfo.BaseFareAmtInclTax|e }}";
var flagArrivalMin="{{ ReturnFlightSegmentInfo.FlagMinAmt|e }}";
//console.info(arrivalDate);console.info(arrivalDate == dateArrivalRequest);
if( arrivalDate == dateArrivalRequest)
{
montantGlobal+=parseFloat(amountArrivalDate);
volSelected['Arrival']="{{key4}}";
$('#retour').append('<div class="v2_blocselectionorange"><div class="v2_blocselectionorangehaut">'+weekArrivalDayName+'<br />'+arrivalDate+'</div><div class="v2_blocselectionorangebasblanc">à partir de <br /><span class="v2_prixselection">'+amountArrivalDate+' dt</span><div class="v2_prixselectionradio"><input type="radio" id="selectionRetour'+"{{key4}}"+'" name="selectionRetour" value="1" checked="checked"></div></div></div>');
dateArrivalRequestedFound =1;
}else {
if(flagArrivalMin =! 1){
$('#retour').append('');
}else {
$('#retour').append('<div class="v2_blocselection"><div class="v2_blocselectionhaut">'+weekArrivalDayName+'<br />'+arrivalDate+'</div><div class="v2_blocselectionbasjaune">à partir de <br /><span class="v2_prixselection">'+amountArrivalDate+' dt</span><div class="v2_prixselectionradio"><input type="radio" name="selectionRetour" id="selectionRetour'+"{{key4}}"+'" value="1"></div></div></div>');
if(dateArrivalRequestedFound==0 && moinsCherArrivalSelected==0){
$('input[type=radio][name=selectionRetour]').attr('checked', 'checked');
moinsCherArrivalSelected=1;
montantGlobal+=parseFloat(amountArrivalDate);
}
}
}
{% endfor %}
{% endfor %}
{% endfor%}
{% endfor %}
});
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
谁能告诉我如何强制执行更改事件?!我想在第一步中声明我的功能更改,然后每次我有更改时我都会执行它,实际上在加载我的页面时必须执行更改然后如果用户单击另一个单选按钮,更改将重新-执行。我在做正确的选择吗?