我的HTML如下:创建动态的div和追加内容
<div id="theContentsm">
<div class="wrap1" style="width:110px; padding-bottom:3px; float:left; margin-right:5px; margin-bottom:5px; border:1px solid #CCC;">
<div class="photoid1" style="width:104px; height:94px; float:left; margin-left:3px; margin-top:3px;"><img src="images/picture-1.jpg" width="104" height="94"></div>
<div class="captionid1" style="width:106px; padding-bottom:2px; float:left; margin-left:2px; margin-top:3px; font-family:Verdana, Geneva, sans-serif; font-size:13px; text-align:center;">
Some Title
<div style="clear:both;"></div>
</div>
<div style="clear:both;"></div>
</div>
</div>
怎么可能产生这种div元素和追加一些内容? (图片和标题)。
我的想法是:
//追加内#theContentsm第一个div
$('<div style="width:110px; padding-bottom:3px; float:left; margin-right:5px; margin-bottom:5px; border:1px solid #CCC;"></div>').html('<div class="photoid1" style="width:104px; height:94px; float:left; margin-left:3px; margin-top:3px;"><img src="http://www.thedomain.com/images/picture-1.jpg" width="104" height="94"></div>').appendTo('#theContentsm');
//现在我需要追加和DIV CLASS = “captionid1” 吼叫,我已经在div创建来保存我的标题..我如何实现这个?
而且体内:
<div id="theContentsm" style="width:100%; padding-bottom:5px;">
<div style="clear:both;"></div>
</div>
我使用的代码之后的伟大工程!谢谢!!谢谢你们! –