anchor.diff:    <script>
         jQuery(document).ready(function () {
             // Adding an event listener to the team assignment checkbox.
  -          jQuery('#team_assignment').change(function() {
  -              insertTeamBasedElements(this.checked)
  +          jQuery('#assignment_form[assignment][max_team_size]').change(function() {
  +              insertTeamBasedElements()
             });
   
             <% if @assignment_form.assignment.vary_by_round %>
  
positive.code:           );
  
            var teamAssignmentCheckbox = jQuery('#team_assignment')
            insertTeamBasedElements(teamAssignmentCheckbox.is(':checked'))
  
            var bookmark_checkbox = jQuery('#assignment_form_assignment_use_bookmark');
            if (bookmark_checkbox.is(':checked')) {
  
negative.code:         }
      }
  
      function insertTeamBasedElements() {
          var varyByDutyDiv = jQuery('#vary_by_duty');
          varyByDutyDiv.removeAttr('hidden');
          var varyByDutyCheckbox = jQuery('#vary_by_duty_checkbox');
          if (varyByDutyCheckbox.is(':checked')) {
              addDutyBasedQuestionnaires();
          } else {
              addDefaultTeammateReviewQuestionnaire();
          }
      }
  </script>
  