title: Changing required field dynamicly via JS in Contact Form 7
body: <p>I need to write custom validated form in Wordpress. After the click on For-Author radio button some checkboxes group should be marked as not required. I tried to change "aria-required" attributes to "false" or remove and add class "wpcf7-validates-as-required" but it doesn't work. I also tried to reinit wpcf7 by</p>
  
  <pre><code>$('div.wpcf7 &gt; form').wpcf7InitForm();
  </code></pre>
  
  <p>but it's also doesn't work.</p>
  
  <p>This is a code sample:</p>
  
  <pre><code>$radio.button.click(function (event) {
      isAuthor(event)
  });
  
  var isAuthor = function (event) {
      if ($(event.target).attr('data-author') == 'true') {
          authorClicked = true;
      } else {
          authorClicked = false;
      }
      fieldUpdate();
  };
  
  var fieldUpdate = function () {
      var $text = $('[name=pres-title]');
      if (authorClicked) {
          $text.prop('disabled', false).attr('aria-required', true).addClass('wpcf7-validates-as-required').attr('aria-invalid', false)
          $fieldRequired.each(function () {
              $(this).prop('disabled', false).attr('aria-required', true).addClass('wpcf7-validates-as-required').attr('aria-invalid', false);
          });
      } else {
          $text.prop('disabled', true).attr('aria-required', false).removeClass('wpcf7-validates-as-required').attr('aria-invalid', false);
          $fieldRequired.each(function () {
              $(this).prop('disabled', true).attr('aria-required', false).removeClass('wpcf7-validates-as-required').attr('aria-invalid', false);
          });
      }
  }
  </code></pre>