Force manual click on Youtube iframe using Jquery

Related searches

I need to play the video on "Play" button click on a site

I tried using this code but it doesn't trigger the play on the Youtube Video.

jQuery(document).on('click', '.eg-henryharrison-element-2', function(event) { 
  event.preventDefault(); 
  jQuery(".esg-youtubevideo").click(); 
});

You should try adding autoplay=1 option to your iframe src like this

<iframe width="420" height="345" src="https://www.youtube.com/embed/qYcSef6Mk58?version=3&enablejsapi=1&html5=1&controls=1&autohide=1&rel=0&showinfo=0&fs=1&playsinline=1&autoplay=1" frameborder="0" allowfullscreen></iframe>

Here is a related question already been asked at stack overflow: YouTube Iframe embed auto play

Play and Pause Buttons for YouTube and Vimeo Videos (via Their , Sometimes you just need to start a video playing by some user interaction on the page other than clicking right on that video itself. Perhaps a  Access elements and contents inside an iFrame using jQuery is simple. We can use contents() method to access the elements inside an iFrame. To know more Visit www.codeexpertz.com.

Maybe I don't understand what you actually want to achieve, but:

For me the following works:

$('.esg-click-to-play-video').first().click()

See here:

Before:

After:

How to Control YouTube's Video Player with JavaScript, Did you know that YouTube has a powerful JavaScript API for controlling its embedded videos? Learn how to use it by reading this short guide. This video explains how you can use jQuery to get the content of an iframe located on the same server. If you want to see the text version go to http://www.g

This should work

$('.esg-youtube-frame').each(function(){ 
    var src = $(this).data('src'); 
    src += "&autoplay=1"; 
    $(this).data('src',src); 
});

Simulate "click" to trigger non-autoplaying iframe video to play, 4 replies | Web Development and Education Industry IT. It doesn't support autoplay like YouTube or other sites would. Is there a way to embed into the HTML a simulated "click", to happen perhaps 10 seconds after the  Complete steps is described in this video regarding How To Access Contents Of An Iframe In Jquery/Javascript If you got any clarification on this, please write it on Comment section. We will

YouTube Player API Reference for iframe Embeds, This guide explains how to use the IFrame API. It identifies the different types of events that the API can send and explains how to write event listeners to respond​  In this video I show you how to update a page without refreshing using jQuery and JSON objects. Being able to do this is a key feature of single-page applications (SPA). Join my free course on the

How to play/pause video using jQuery ?, Method 1: Using trigger() method: The trigger() method is used to execute a specified event and the default behavior of the event. Using these events with the trigger() method will play or pause the video as required. Click on the buttons to play In jQuery, the video file is first selected using a selector and the actual  Get The Total Sum Of Table Row Column Cells Value Using jQuery 3.3.1 - Duration: 6:19. Haritha Computers & Technology 11,373 views

Hi everyone, I'm very new to jQuery and quite rusty with my web design in general. I have a page on my site with 5 buttons alongside an iframe which is embedded from Youtube showing a video.

Comments
  • Hi Goldy, Thanks for your reply. Unfortunately, I'm not asking about autoplaying the video.
  • You can do it this way $('.esg-youtube-frame').each(function(){ var src = $(this).data('src'); src += "&autoplay=1"; console.log(src); $(this).data('src',src); });
  • @Goldy please edit your answer and add your comment in the answer.