- HTML5 Web Application Development By Example Beginner's Guide
- J.M. Gustafson
- 124字
- 2021-08-13 16:50:20
HTML templates
As you can see, things are getting a little messy in our addTaskElement()
method. We are creating a bunch of elements programmatically in JavaScript and manually adding them to the DOM. Wouldn't it be a lot easier if we could just define what we want the task element's structure to look like in our HTML file and use it to create new tasks? Well we can, and we will. In this section we'll create an HTML template that we can reuse to easily create new tasks.
Note
There are plenty of JavaScript libraries out there for implementing HTML templates and they have a lot of powerful features, but for our application all we need is something simple, so we'll implement our own.
推薦閱讀
- Python量化投資指南:基礎(chǔ)、數(shù)據(jù)與實戰(zhàn)
- ThinkPHP 5實戰(zhàn)
- Building a RESTful Web Service with Spring
- PHP基礎(chǔ)案例教程
- Mastering Concurrency in Go
- Python金融數(shù)據(jù)分析
- Python Geospatial Development(Second Edition)
- 編寫高質(zhì)量代碼:改善C程序代碼的125個建議
- Drupal 8 Configuration Management
- C# 8.0核心技術(shù)指南(原書第8版)
- C語言程序設(shè)計與應用(第2版)
- 算法圖解
- Practical Predictive Analytics
- Mastering SciPy
- Visual C++開發(fā)寶典