1
0
Fork 0
foerderbarometer/input/static/dropdown/js/mail.js

36 lines
1014 B
JavaScript
Raw Permalink Normal View History

2023-02-27 17:09:29 +00:00
window.addEventListener("load", function() {
(function($) {
$(function() {
// mail section
var selectField_addrOther = $('#id_address'),
data_addrOther_div = $('#id_other').parent().parent(),
data_addrOther = $('#id_other');
console.log(data_addrOther, data_addrOther_div );
// make checked to get through the required
function toggleVerified_addrOther(value) {
if (value === "OTHER") {
data_addrOther_div.show();
data_addrOther.val("");
} else {
data_addrOther_div.hide();
data_addrOther.val("NONE");
}
}
// show/hide on load based on existing value of selectField
toggleVerified_addrOther(selectField_addrOther.val());
// show/hide on change
selectField_addrOther.change(function() {
toggleVerified_addrOther($(this).val());
});
});
})(django.jQuery);
});