title: "Uncaught TypeError: Cannot use 'in' operator to search for 'length' in" when getting checked values by data attribute
body: <p>This is the view of checkbox group
  <a href="https://i.stack.imgur.com/sh08m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sh08m.png" alt="enter image description here"></a></p>
  
  <p>And this is my html code for the above view(there is more check boxes, only 2 mention here):</p>
  
  <pre><code>    &lt;div class="panel-body subject_names"&gt;
     &lt;div class="col-md-12"&gt;
        &lt;label for="checkboxes-0" class="col-md-7"&gt;
        KE1-Financial Accounting &amp;amp; Reporting Fundamen
        &lt;/label&gt;
        &lt;input type="checkbox" data-subject-name="KE1-Financial Accounting &amp;amp; Reporting Fundamen" data-subject-ai="925" class="big-checkbox col-md-1 subject1" name="exam_subjects" id="checkboxes-0" value="1012"&gt; 
        &lt;div class="col-md-4 pull-left"&gt;
           &lt;input id="training_institute" name="textinput" type="text" placeholder="" class="input-md"&gt;
        &lt;/div&gt;
     &lt;/div&gt;
  
     &lt;div class="col-md-12"&gt;
        &lt;label for="checkboxes-0" class="col-md-7"&gt;
        KE2-Management Accounting Information
        &lt;/label&gt;
        &lt;input type="checkbox" data-subject-name="KE2-Management Accounting Information" data-subject-ai="926" class="big-checkbox col-md-1 subject1" name="exam_subjects" id="checkboxes-0" value="1013"&gt; 
        &lt;div class="col-md-4 pull-left"&gt;
           &lt;input id="training_institute" name="textinput" type="text" placeholder="" class="input-md"&gt;
        &lt;/div&gt;
     &lt;/div&gt;
  
  
  &lt;/div&gt;
  </code></pre>
  
  <p>and this is my js code :</p>
  
  <pre><code>var subjects_names = [];
  $.each($("input[name='exam_subjects']:checked").attr("data-subject-name"), function() {
      subjects_names.push($(this).val());
  });
  </code></pre>
  
  <p>Exception:</p>
  
  <pre><code>Exam_application_c:775 Uncaught TypeError: Cannot use 'in' operator to search for 'length' in KE1-Financial Accounting &amp; Reporting Fundamen
  </code></pre>