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.

35 lines
1014 B

  1. window.addEventListener("load", function() {
  2. (function($) {
  3. $(function() {
  4. // mail section
  5. var selectField_addrOther = $('#id_address'),
  6. data_addrOther_div = $('#id_other').parent().parent(),
  7. data_addrOther = $('#id_other');
  8. console.log(data_addrOther, data_addrOther_div );
  9. // make checked to get through the required
  10. function toggleVerified_addrOther(value) {
  11. if (value === "OTHER") {
  12. data_addrOther_div.show();
  13. data_addrOther.val("");
  14. } else {
  15. data_addrOther_div.hide();
  16. data_addrOther.val("NONE");
  17. }
  18. }
  19. // show/hide on load based on existing value of selectField
  20. toggleVerified_addrOther(selectField_addrOther.val());
  21. // show/hide on change
  22. selectField_addrOther.change(function() {
  23. toggleVerified_addrOther($(this).val());
  24. });
  25. });
  26. })(django.jQuery);
  27. });