开发者

How to add div inside other div in gallery script using jQuery?

开发者 https://www.devze.com 2023-03-14 05:34 出处:网络
I want to add a <div> inside a <div class=\"ad-image\"> - How can it be done? Gallery script is here: http://coffeescripter.com/code/ad-gallery/

I want to add a <div> inside a <div class="ad-image"> - How can it be done?

Gallery script is here: http://coffeescripter.com/code/ad-gallery/

This is the way I created <div class="开发者_StackOverflow社区ad-image">

var img_container = $(document.createElement('div')).addClass('ad-image');


var img_container = $(document.createElement('div')).addClass('ad-image'),
    new_div = $("<div></div>");

img_container.append(new_div);


You can do it by

$(".ad-image").append("<div>New div here</div>")


$('<div class="ad-image" />').appendTo($('div'));

Working jsfiddle: JsFiddle demo

0

精彩评论

暂无评论...
验证码 换一张
取 消