0
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>

$('a.play-video').click(function(){
    $('.youtube-video')[0].contentWindow.postMessage('{"event":"command","func":"' + 'playVideo' + '","args":""}', '*');
});



$('a.stop-video').click(function(){
    $('.youtube-video')[0].contentWindow.postMessage('{"event":"command","func":"' + 'stopVideo' + '","args":""}', '*');
});


$('a.pause-video').click(function(){
    $('.youtube-video')[0].contentWindow.postMessage('{"event":"command","func":"' + 'pauseVideo' + '","args":""}', '*');
});

</script>

I have created function using Jquery which on click plays and pauses a youtube video linked above in the file but I want to add this file to Wordpress and I can't use Jquery Function on Wordpress, please Help me how to do it.

4
  • 1
    Does this answer your question? How do I add a simple jQuery script to WordPress? Commented Jan 21, 2021 at 19:01
  • No man, this stack is confusing Commented Jan 21, 2021 at 19:05
  • Why does it not help? Remember, we can’t see your screen Commented Jan 21, 2021 at 19:06
  • You're right man, I'm just trying it all out Commented Jan 21, 2021 at 19:12

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.