Skip to main content
1-Visitor
February 15, 2019
Solved

Click Event on Video Widget

  • February 15, 2019
  • 6 replies
  • 3036 views

Hey there,

Is there a possiblity to catch the click event on a video widget? If I catch all click events how can i get the ID of the widget which is clicked?

Thanks for help.

Best answer by mn1

I solved the problem alreay by myself!

6 replies

mn11-VisitorAuthorAnswer
1-Visitor
February 18, 2019

I solved the problem alreay by myself!

18-Opal
February 18, 2019

What was your solution?

mn11-VisitorAuthor
1-Visitor
February 19, 2019

Hi,

I added an Event Handler:

window.addEventListener('click', $scope.Ausgabe);

and in the function Ausgabe I checked, if the click Event was sendet by a Video:

 

$scope.Ausgabe=function(){
console.log("A click event is recived");
if (window.event.path[0].tagName=='BUTTON'|| window.event.path[0].tagName=='IMG'){
console.log(window.event.path[2].attributes["0"].nodeValue); // if an image or button was clicked, this line prints the id
}
if (window.event.path[0].tagName=='VIDEO'){
console.log(window.event.path[3].attributes["0"].nodeValue); // If a video was clicked, this line prints the id

}