Dynamically Load Youtube Video Iframe embed Code inside a DIV

Last updated on
Categories Under // ideasA Template Review by . No Comments

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


+ 6 = fourteen

 

Search

Recent Templates

  • Yarn Prestashop Template 49045
  • Infant Store Prestashop Template 49001
  • Attractor - Responsive One Page Parallax WordPress Theme
  • Compass - MultiPurpose Responsive WordPress Theme
  • The Company - Responsive MultiPurpose 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