Home » Javascript » JQuery – click-Event on HTML5-Video in FireFox

JQuery – click-Event on HTML5-Video in FireFox

Posted by: admin October 18, 2018 Leave a comment

Questions:

I have a some simple HTML5-Videos on my page and I want to do stuff when a user hac clickes on one of it.

So the video is like

<video height="171" controls="" class="img-thumbnail" data-id="20" data-txt="" data-title="" id="img-thumbnail-20">
    <source src="./assets/files/video/end.mp4" type="video/mp4">
    Your browser does not support the video tag.
</video>

and then I do:

$(document).ready(function() { 
   $("body").click(function(e) {            
        var classClicked = ($(e.target).attr('class')); 
        if(classClicked == "img-thumbnail") { 
        ............ 

This works on Chrome but not on FireFox.
I also tried a onclick="bla()" in the video-tag, but still the same.. works in Chrome but not in Firefox

How can I catch a users click in FF ?

Answers: