title: jquery - capture data attributes
body: <p>While iterating through a a set of input nested into groups and sections, 
  I want to try to capture the data-group and section-group, but need a push...</p>
  
  <pre><code>&lt;script src="jquery.mobile/jquery.js"&gt;&lt;/script&gt;
  
  &lt;div  id="groupA" data-group="A" class="preGroups"&gt;
  
      &lt;div id="section-A1"  data-section="1"&gt;
      &lt;input name="SRPR1"  type="text"&gt;
      &lt;input name="SRPR2"  type="text"&gt;
      &lt;/div&gt;
  
      &lt;div id="section-A2"  data-section="2"&gt;
      &lt;input name="SRPR1"  type="text"&gt;
      &lt;input name="SRPR2"  type="text"&gt;
      &lt;/div&gt;
  
      &lt;div id="section-A3"  data-section="3"&gt;
      &lt;input name="SRPR1"  type="text"&gt;
      &lt;input name="SRPR2"  type="text"&gt;
      &lt;/div&gt;
  
      &lt;div id="section-A4" data-section="4"&gt;
      &lt;input name="SRPR1"  type="text"&gt;
      &lt;input name="SRPR2"  type="text"&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div  id="groupB"  data-group="B" class="preGroups"&gt;
  
      &lt;div id="section-B1" data-section="1"&gt;
      &lt;input name="SRPR1"  type="text" value="1"&gt;
      &lt;input name="SRPR2"  type="text"value="1"&gt;
      &lt;/div&gt;
  
      &lt;div id="section-B2" data-section="2"&gt;
      &lt;input name="SRPR1"  type="text"value="1"&gt;
      &lt;input name="SRPR2"  type="text"&gt;
      &lt;/div&gt;
  
      &lt;div id="section-B3" data-section="3"&gt;
      &lt;input name="SRPR1"  type="text"&gt;
      &lt;input name="SRPR2"  type="text"&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;script&gt;    
  
  
      var currentGroup = "";
      var currentSection = "";
  
      // iterate through each group in groups
      groups = $('div[id^="group"]'); 
      $.each(groups, function(key, group) {
          currentGroup = group.getAttribute('group');
          // iterate through each section in group 
          sections = $(group).find('div[id^="section"]'); 
          $.each(sections, function(key, section) {
              currentSection = section.getAttribute('section');
  
              var inputs = $(section).find("input");
              inputs.each(function(){
  
                  fnValidateDetails(currentGroup, currentSection, this.name, this.value)
              })
          });
      });
  
  function fnValidateDetails(currentGroup, currentSection, theName, theValue ){
  
      console.log(currentGroup, currentSection, theName, theValue);
  
  }
  
  &lt;/script&gt;   
  </code></pre>