You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
803 B

  1. window.addEventListener("load", function() {
  2. (function($) {
  3. $(function() {
  4. var selectField = $('#id_variant'),
  5. verified_div = $('#id_url_of_pic').parent().parent(),
  6. verified_data = $('#id_url_of_pic');
  7. function toggleVerified(value) {
  8. if (value === 'PIC') {
  9. verified_div.show();
  10. verified_data.val("");
  11. } else {
  12. verified_div.hide();
  13. verified_data.val("NONE");
  14. }
  15. }
  16. // show/hide on load based on existing value of selectField
  17. toggleVerified(selectField.val());
  18. // show/hide on change
  19. selectField.change(function() {
  20. toggleVerified($(this).val());
  21. });
  22. });
  23. })(django.jQuery);
  24. });