//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);
See Coding offers easy, practical solutions in PHP, CSS, Magento, WordPress, JavaScript, jQuery, and more. Our content is designed to simplify coding concepts, providing tips and step-by-step guides to help developers of all levels enhance their coding skills. With a focus on real-world applications, we cover debugging, optimization, and best practices, keeping you updated on the latest in the field. Whether you’re a beginner or an experienced coder, See Coding is here to support your learning.
jQuery- Stop YouTube video within iFrame on external Button click
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment