title: How to get text() by attr() in jquery
body: <p>Here's the questions</p>
  
  <pre><code>&lt;div class="question"&gt;
              &lt;div class="button" data-q="1" data-a="1"&gt;&lt;a href="javascript:void();"&gt;2002&lt;/a&gt;&lt;/div&gt;
              &lt;div class="button" data-q="1" data-a="2" data-g="true"&gt;&lt;a href="javascript:void();"&gt;2010&lt;/a&gt;&lt;/div&gt;
              &lt;div class="button" data-q="1" data-a="3"&gt;&lt;a href="javascript:void();"&gt;1985&lt;/a&gt;&lt;/div&gt;
              &lt;div class="button" data-q="1" data-a="4"&gt;&lt;a href="javascript:void();"&gt;2013&lt;/a&gt;&lt;/div&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>I would like to have the text() value for the attr() that have data-g set.</p>
  
  <p>Right now the code I tried don't work</p>
  
  <pre><code>$('.question .button a').click(function(){    
    var aText = $(this).parents('.question').find('data-g').text();
    return aText;
  });
  </code></pre>
  
  <p>I've tried this one but I get all text inside the .question DIV (2002,2010,1985,2013)</p>
  
  <pre><code>$('.question .button a').click(function(){    
    var aText = $(this).parents('.question').text();
    return aText;
  });
  </code></pre>
  
  <p>So how can I have only the result of the DIV with data-g attribute and get only the 2010 as text.</p>
  
  <p>Thanks</p>