javascript - JQuery append a div start tag only -
this question has answer here:
- jquery - how add single html tag html? 5 answers
- create opening div tag using jquery 2 answers
is there way insert div start tag $('#adiv').append("<div class='divtoinsert>'");
but creates: <div class='divtoinsert></div>
instead.
i want append start tag because in middle, adding content , want insert end tag when have added content.
i looking on net day unlucky enough give me hint.
sure, create string variable hold open tag, concatenate content inside loop or whatever want, concatenate closing tag. can append variable element when finished.
example:
var yourtext = "<div>"; yourtext += //whatever want yourtext += "</div>"; $('#adiv').append(yourtext);
Comments
Post a Comment