jquery - Copying template code into a page -
i'd have html divs tucked away @ bottom of page display:none. periodically want copy 1 of these divs, make custom changes (display:block, one) , , insert somewhere in dom. @ end of operation template div should still @ bottom of page unchanged.
i'm wondering if suggest best jquery accomplish this?
thanks
i agree couzzi above, these should dynamically created. howver, how interpreted question (simple concept): http://jsfiddle.net/5xjbn/
<div>you can see me!</div> <div id="append"></div> <input type="button" value="click me" id="btn"/> <div id="hidden1" style="display: none;">you cant see this!</div>
you can see above div @ bottom hidden. i'm going select it, take content out, append div id: append, , change color red (on button click).
$("#btn").click(function() { var hiddendiv = $("#hidden1").html(); $("#append").html(hiddendiv).css("color", "red"); });
the hidden div remains unchanged, , unseen.
Comments
Post a Comment