title: How to get data attribute with "onclick" method?
body: <p>I have following two &quot;div&quot; with &quot;anchor&quot; tag and i want to get &quot;attribute&quot; with &quot;onclick&quot; function,Here is my html code</p>
  <pre><code>&lt;div class=&quot;upvote_dm&quot;&gt;
  &lt;a class=&quot;pr_vote_up '.$clssup.' btnsnew '.$FeedId.'&quot; data-datac=&quot;1&quot; data-flagid='.$FeedId.' id=Up'.$FeedId.' data-type=&quot;feed&quot; data-datacw='.$UserWalletAddress.' href=&quot;#&quot;  data-id=&quot;10&quot; onclick=&quot;return AddFeedVotes()&quot;&gt;&lt;/a&gt;
  &lt;span id=&quot;UpVoteCount'.$FeedId.'&quot;&gt;'.$DefaultUpVotes.'&lt;/span&gt;
  &lt;/div&gt;
                     
  &lt;div class=&quot;downvote_dm&quot;&gt;
  &lt;a class=&quot;pr_vote_down '.$clssdown.' btnsnew '.$FeedId.'&quot; data-datac=&quot;0&quot; data-status=&quot;Down'.$FeedId.'&quot; data-flagid='.$FeedId.' id=Down'.$FeedId.' data-type=&quot;feed&quot; data-datacw='.$UserWalletAddress.' href=&quot;#&quot; data-id=&quot;10&quot; onclick=&quot;return AddFeedVotes()&quot;&gt;&lt;/a&gt;
  &lt;span id=&quot;DownVoteCount'.$FeedId.'&quot;&gt;'.$DefaultDownVotes.'&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  <p>Now i am trying to get attribute with following way but showing me &quot;Undefine&quot;,Where i am wrong ?</p>
  <pre><code>&lt;script&gt;
         function AddFeedVotes()
              {
                  var vote = $(this).data('datac');
                  var type = $(this).data('type');
                  var flagid = $(this).data('flagid');
                              
                  alert(vote);
                  alert(type);
                   alert(flagid);    
              }
  &lt;/script&gt;
  </code></pre>