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