Dynamically Load Youtube Video Iframe embed Code inside a DIV

Last updated on
Categories Under // ideasA Template Review by . No Comments
[UPDATED : The code has been updated to work in latest version of Firefox. May 20,2014]

By storing or by having the Iframe embed code as a variable, You can play the Youtube video on a click of a button or any other event.  I have used “append” function of jQuery to append the IFrame code dynamically inside a DIV tag.

Check the Demo Page for Loading YouTube Video Embed Code Dynamically

How it Works :

The textarea contains the iframe code.  Please note that you can embed any Youtube Iframe embed code and click on the button.  The button is just a link.  It uses “event.preventDefault(); ” function to avoid page refresh.

I have tested it in IE, Firefox.  Please check in your browsers too.  Please comment and enhance the code.

Load YouTube Video Dynamically inside a DIV

Load YouTube Video Dynamically inside a DIV

Latest WordPress Templates

Leave a comment


two + = 4

 

Search

Recent Templates

  • cf7-installation
  • featured-image
  • Mobile Prestashop Template 51309
  • Kallyas - Fluid Responsive Prestashop Theme
  • Perfectum – Premium Responsive Prestashop theme
  • Mindig - Flat & Multipurpose Ecommerce WordPress Theme
  • Camera – Responsive Creative WordPress Theme

WordPress Expert at $14/hour

Hi, I am the webmaster who run this website. I am a WordPress Integrator. If you are need of

-- Adding content to WordPress blog
-- Help in managing plugins and upgrading them.
-- Backing up WordPress Blogs.
-- Modifying theme to suit new ideas and designs.
-- Converting a PSD/JPG/PNG into WordPress

Please contact me at vr@pixelthemes.com or through contact form.

Become Our Fan in Facebook