Hue
Hue

Reputation: 471

jquery wrap an iframe in div

How would I make jquery wrap an iframe in a div e.g if using a vimeo embed iframe, on load jquery wraps it in a div class:

<div class="iframe"><iframe src="http://player.vimeo.com/video/23358638?title=0&amp;byline=0&amp;portrait=0" width="500" height="300" frameborder="0"></iframe></div>    

Upvotes: 7

Views: 8701

Answers (1)

Sylvain
Sylvain

Reputation: 3873

Use jQuery wrap() function :

$("iframe").wrap("<div class='iframe'/>");

Upvotes: 19

Related Questions