I am dynamically adding some html with jQuery and I want to paste it directly on top of another element. How to do it?
this is the code in application.js file:
$(document).ready(function() {
$('a.oembed').embedly({maxWidth:300,'method':'replace'}).bind('embedly-oembed', function(e, oembed){
$("#video_div").append($("<img>", { src: oembed.thumbnail_url, width:200 }));
});
});
The image is inserted dynamically, and I want it to be directly on top of this:
<div id="video_div"><%= link_to 'video', @video.video_url, :class => 'oembed' %></div>
source
share