开发者

append a close tag with jquery

i have this situation:

here start foor loop ...

$("#sez:last").append("<开发者_如何学编程div id=\"sezDati\" class=\"counter_"+d+"\">"+name+"</div>");         if ( d  ==  6  ){ $("#sez:last").find(".counter_6").after().wrap("</div><div id=\"sezDati\">");
}
d++

After 6 div #sezDati i need to append first a close tag then reopen a sezDati div... Any help??

thanks


You really shouldn't be using the same id for more than one element. Use your counter to generate the dynamic ids and use those instead. Also why are you using .after().wrap() in this case? Surely what you need is just an .after().

Something like:

$("#sez:last").append("<div id=\"sezDati_"+d+"\" class=\"sezDati\">"+name+"</div>");
if ( d  ==  6  ){ 
   $("#sez:last").find(".sezDati_6").after("</div><div id=\"sezDati\">");
}
d++
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜