- 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.
推薦閱讀
- 少兒人工智能趣味入門:Scratch 3.0動畫與游戲編程
- Python編程自學(xué)手冊
- Mastering OpenCV Android Application Programming
- 基于Java技術(shù)的Web應(yīng)用開發(fā)
- 計算機(jī)應(yīng)用基礎(chǔ)實(shí)踐教程
- Babylon.js Essentials
- Learning Unreal Engine Android Game Development
- Machine Learning in Java
- 0 bug:C/C++商用工程之道
- Mastering Akka
- Citrix XenServer企業(yè)運(yùn)維實(shí)戰(zhàn)
- Unity Character Animation with Mecanim
- 深度實(shí)踐KVM:核心技術(shù)、管理運(yùn)維、性能優(yōu)化與項目實(shí)施
- scikit-learn Cookbook(Second Edition)
- Python繪圖指南:分形與數(shù)據(jù)可視化(全彩)