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&byline=0&portrait=0" width="500" height="300" frameborder="0"></iframe></div>
jQuery wrap() method is used to wrap specified HTML elements around each selected element. The wrap () function can accept any string or object that could be passed through the $() factory function. Syntax: $(selector).
You can use jQuery to add jQuery effects to your iFrame elements, to change the CSS rules, or even to add content. Above, the script is used to change the background color of the . page element within the frame to white.
You can use wrapAll() function!
The wrap() method wraps specified HTML element(s) around each selected element.
Use jQuery wrap()
function :
$("iframe").wrap("<div class='iframe'/>");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With