1. Code
  2. Web Development

Quick Tip: Create a Makeshift JavaScript Templating Solution

Read Time:2 minsLanguages:

Sometimes, you don't require a high-quality templating solution, but still need to keep from mixing lots of nasty HTML into your JavaScript. In these cases, a simple, makeshift templating system can go a long way.

Choose 720p for the best clarity.
Subscribe to our YouTube channel for more training.

Final Source




The method outlined in the screencast is the most readable, however, if you'd prefer a more automated approach, we can apply the values and regular expressions dynamically, like so:

This is the method that I'm most likely to use.

Additional Tools

If you'd prefer a more flexible solution, any of the following should do the trick!

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.