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

36 lines
1014 B
JavaScript
Raw Normal View History

2022-12-05 10:19:03 +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);
});