Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://wiki.cmc.msu.ru/System/JQueryTmpl
Дата изменения: Unknown Дата индексирования: Sat Apr 9 23:12:55 2016 Кодировка: koi8-r |
jQuery templates contain markup with binding expressions ('Template tags'). Templates are applied to data objects or arrays, and rendered into the HTML DOM
Documentation for the jQuery Templates plugin can be found on the jQuery documentation site: http://api.jquery.com/category/plugins/templatesNote: The jQuery team has decided not to take this plugin past beta. It is no longer being actively developed or maintained. The docs remain here for the time being (for reference) until a suitable replacement template plugin is ready.
For more on the history of this change, see Official Plugins: A Change in the Roadmap and jQuery Templates and JsViews: The Roadmap Note: See tagged versions for stable Beta releases. Requires jquery version 1.4.2.text/x-jquery-tmpl
. This is going to be used
by jquery.tmpl in a loop over all data provided and render a list item for each by inserting the data
from the array into this template and append it to the movie list
<script id="movieTemplate" type="text/x-jquery-tmpl"> <li> <b>${Name}</b> (${ReleaseYear}) </li> </script>
This is example stores data locally in a javascript array. You may also fetch this data using remote data. See the second example.
<script> jQuery(function($) { var movies = [ { Name: "The Red Violin", ReleaseYear: "1998" }, { Name: "Eyes Wide Shut", ReleaseYear: "1999" }, { Name: "The Inheritance", ReleaseYear: "1976" } ]; $("#movieTemplate").tmpl(movies).appendTo( "#movieList"); }); </script>The result will be appended to the
movieList
element:
<ul id="movieList"></ul>