я использую jquery и хочу сделать ниже написано
//this is a template
<div class='main'>
<div class='header'>Some Text</div>
<div class='data'>
// data goes here
</div>
</div>
// dom
--------dom here-------------
<div id='red1' class='red'></div>
-----more dom (template is here)------------
я хочу привязать шаблон к любому элементу (скажем, id = red1), чтобы получить dom, как написано ниже
// ниже новый дом
--------dom here-------------
<div class='main'>
<div class='header'>Some Text</div>
<div class='data'>
// element is wrapped with template
<div id='red1' class='red'></div>
</div>
</div>
-----more dom (**template is still here**)------------