vicodin vicodin - 1 year ago 72
HTML Question

Where to store js templates?

I have some HTML templates, I use them for generating some new elements with jQuery. For now, I keep them in the bottom of my page as

<script type="text/html" id="ID_to_refer_from_jQuery">...HTML code here...</script>
, but I think it's a bad way, so where I can store such templates?


Put them in another folder and call them in with AJAX. You don't want to have one huge file. Rather, leverage the organizational folder system to keep your project organized.

Example Folder Structure



Loading Them In