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.

24 lines
628 B

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