jQuery- Stop YouTube video within iFrame on external Button click

 
//First get the  iframe URL
var url = jQuery('#YourIFrameID').attr('src');

//Then assign the src to null, this then stops the video been playing
jQuery('#YourIFrameID').attr('src', '');

// Finally you reasign the URL back to your iframe, so when you hide and load it again you still have the link
jQuery('#YourIFrameID').attr('src', url);

No comments:

Post a Comment