…One of the nice features that jQuery template gives you…is the ability to define simple helper functions called formatters.…Formatters can take the value of a data field,…and either format it or transform it in some way.…The way that you does this is you use the addTemplateFormatter function,…which will add a function that takes a value and transforms it.…Now in this case, I'm, to finding a formatter called UpperCase.…And UpperCase will be a function that takes two arguments.…
The first one is the value that's going to be formatted.…And this comes in from the data that was passed to jQuery template.…The second one is any options that you might want to pass to the formatter.…And again, they're optional, but it can come in handy.…In order to use the formatter, what you do is you define a data-format…attribute on the container for the data field that you want to be formatted.…So in this particular example, you can see there, that on the…field for title, I'm defining the data format attribute to be UpperCase.…
- What is templating?
- Defining templates in jQuery Template
- Using simple Mustache templates with sections and conditions
- Adding conditionals and loops to Handlebars templates
- Working with Dust templates
Skill Level Intermediate
What is templating?5m 12s
2. jQuery Template
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.