mardi 12 janvier 2021

ABP Jquery not catching checkbox change

Using ABP Commercial and in a generated page I have 2 checkboxes, but I am unable to get the change event of them.

Here is the generated code for the checkbox

<input type="checkbox" data-val="true" data-val-required="The Permanent Resident Australia field is required." id="Prospectus_IsPermanentResidentAustralia" name="Prospectus.IsPermanentResidentAustralia" value="true" class="custom-control-input ">

I have tried a number of ways to get the change event.

$("#Prospectus_IsPermanentResidentAustralia").change(function () {
  $('#permAusDate').toggle();
    });

  $('#Prospectus_IsPermanentResidentAustralia').on("change", function () {
            $('#permAusDate').toggle();
   
});

Also tried it this way.

$(('#IsInternational').val).change(function () {
    if (this.checked != true) {
        $("#InternationalStudent").hide();
    }
    else {
        $("#InternationalStudent").show();
    }
});

If I do this below, it works - the toggle is succesful - but naturally throws an error as change isn't a function as its missing the ()

 var permResidentAus = $('Prospectus.IsPermanentResidentAustralia').change;
$('permResidentAus ').on("change", function () {
           $('#permAusDate').toggle();
 
});

What am I missing in ABP?




Aucun commentaire:

Enregistrer un commentaire