7 days of WordPress plugins, themes & templates - for free!* Unlimited asset downloads! Start 7-Day Free Trial
Advertisement
  1. Code
  2. Web Development

Quick Tip: Create a Makeshift JavaScript Templating Solution

Read Time: 2 mins

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

HTML

JavaScript


Alternative

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!

Advertisement
Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.
Advertisement
Scroll to top
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.