29 lines
803 B
JavaScript
29 lines
803 B
JavaScript
|
window.addEventListener("load", function() {
|
||
|
(function($) {
|
||
|
$(function() {
|
||
|
|
||
|
var selectField = $('#id_variant'),
|
||
|
verified_div = $('#id_url_of_pic').parent().parent(),
|
||
|
verified_data = $('#id_url_of_pic');
|
||
|
function toggleVerified(value) {
|
||
|
if (value === 'PIC') {
|
||
|
verified_div.show();
|
||
|
verified_data.val("");
|
||
|
} else {
|
||
|
verified_div.hide();
|
||
|
verified_data.val("NONE");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// show/hide on load based on existing value of selectField
|
||
|
toggleVerified(selectField.val());
|
||
|
|
||
|
// show/hide on change
|
||
|
selectField.change(function() {
|
||
|
toggleVerified($(this).val());
|
||
|
});
|
||
|
|
||
|
});
|
||
|
})(django.jQuery);
|
||
|
});
|