Rizqi Ahmad from Germany has introduced a nice solution for client-side template based on JQuery. The Chain.js allows you to use any piece of HTML (or embedded HTML string) as template to display data dynamically.
In introductory post, he went through some common approach like server-side data binding, injecting preformatted HTML (into well-known DOM property innerHTML) and directly manipulating DOM, then explained why Chain.js is better way:
- Easy and compact (as it uses JQuery for manipulating DOM)
- Preserve event(s) on updates
- Allow dynamically add/remove data
To use the engine, you’ll need to download JQuery (better the latest version) and Chain.js then add script tags to load them.
<script src="path/to/jquery.js" language="javascript"> </script> <script src="path/to/chain.js" language="javascript"> </script>
Practical Example on Chain.js
Now, we’ll create a practical example that allows user select a programming language and display recommended reading books accordantly. This is almost similar to another example I created for PURE library.
First, build a template table to display book list:
Recommended Reading
Interviewing for SolutionsWritten in a clear, informative, and informal style, INTERVIEWING FOR SOLUTIONS features a unique solutions-oriented approach to basic interviewing in... Read More >
The Blood Sugar Solution: The UltraHealthy Program for Losing Weight, Preventing Disease, and Feeling Great Now!In THE BLOOD SUGAR SOLUTION, Dr. Mark Hyman reveals that the secret solution to losing weight and preventing not just diabetes but also heart disease,... Read More >
The Paleo Solution: The Original Human DietDo you want to lose fat and stay young, all while avoiding cancer, diabetes, heart disease, Parkinson's, Alzheimer's and a host of other illnesses? Th... Read More >



7