Create div tag template and reuse

Posted by user1683645 on Stack Overflow See other posts from Stack Overflow or by user1683645
Published on 2012-10-09T00:01:06Z Indexed on 2012/10/09 3:37 UTC
Read the original article Hit count: 69

Filed under:

Is it possible to create a template e.g with lots of other elements inside it with proper attribute "tagging" and reuse it with jquery? For instance when you want to display user submitted comments without refreshing the page. The reason I ask this is because the code between the div tags are rather long. So using for instance prepend() would be to long to rewrite.

Whats the best approach for larger manipulations? Create a separate html? Im pretty new to manipulation, but since I have a programming background i would expect that there is an efficient way to reuse already existing HTML instead of redefining it in jquery.

© Stack Overflow or respective owner

Related posts about jQuery