javascript - get text of clicked a tag element with siblings -


i trying text on <a> element shown in plunker, first click shows text string correctly, if click again shows twice , thrice next, not sure how prevent it. ??

thanks in advance

http://plnkr.co/edit/efnfsdu1lkw8jvnzk4zz?p=preview

if use angular don't need use jquery events, can pass $event function , text current target, so

$scope.getword = function ($event) {       alert(angular.element($event.target).text()); }  <a class="refer-word" ng-click="getword($event)">javascript</a> <a class="refer-word" ng-click="getword($event)" name ="client">client</a> 

example


Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -