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
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>
Comments
Post a Comment