github github
  • Home
  • Pricing and Signup
  • Training
  • Gist
  • Blog
  • Login

nje / jquery-tmpl forked from jquery/jquery-tmpl

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
    • 253
    • 60
  • Source
  • Commits
  • Network (60)
  • Issues (8)
  • Wiki (11)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Switch Branches (2)
    • gh-pages
    • master ✓
  • Switch Tags (0)
  • Branch List
Sending Request…
Downloads

A templating plugin for jQuery. — Read more

  Cancel

  Cancel
  • HTTP
  • Git Read-Only

This URL has Read+Write access

Added to jquery.tmplPlus a feature for making it really easy to maintain 
BorisMoore (author)
Tue Jul 13 13:13:14 -0700 2010
commit  a02d273a0dece498d6d2
tree    28c0db13d924e065fbb7
parent  d0633ad893498b475b5e
jquery-tmpl /
name age
history
message
file README.md Thu Jul 08 13:20:31 -0700 2010 Completed work on $.templates API for caching/s... [BorisMoore]
directory demos/ Tue Jul 13 13:13:14 -0700 2010 Added to jquery.tmplPlus a feature for making i... [BorisMoore]
file jquery.tmpl.js Tue Jul 13 13:13:14 -0700 2010 Added to jquery.tmplPlus a feature for making i... [BorisMoore]
file jquery.tmplPlus.js Tue Jul 13 13:13:14 -0700 2010 Added to jquery.tmplPlus a feature for making i... [BorisMoore]
README.md

A jQuery templating plugin - created for demonstration purposes.


// Render one LI, filled with data, then append it into the UL

$.tmpl( "<li>${firstName}</li>", dataObject )
    .appendTo( "ul" );

<!-- Declare a template as a script block of type "text/html" -->

<script id="sometmpl" type="text/html">
    <li>${firstName}</li>
</script>

// Render the declared template as one LI appended to the target UL

$( "#sometmpl" )
    .tmpl( dataObject )
    .appendTo( "ul" );

// Render the declared template as multiple LIs appended to the target UL
// Provide a click event accessing the data

$( "#sometmpl" )
    .tmpl( arrayOfDataObjects )
    .appendTo( "ul" )
    .click( function() {
        alert( $.tmpl(this).data.firstName );
    });

// Store a string as a compiled template for later use
$.templates( "myTmpl", "<span>${firstName}</span>" );

// Render stored template and insert after target. 
$.tmpl( "myTmpl", dataObject )
    .insertAfter( "#target" );

A demo page using this plugin can be found here: http://infinity88.com/jquery-tmpl/movies/movies.htm

Dedicated Server Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
  • Blog
  • Support
  • Training
  • Job Board
  • Shop
  • Contact
  • API
  • Status
  • © 2010 GitHub Inc. All rights reserved.
  • Terms of Service
  • Privacy
  • Security
  • English
  • Deutsch
  • Français
  • 日本語
  • Português (BR)
  • Русский
  • 中文
  • See all available languages

Your current locale selection: English. Choose another?

  • English
  • Afrikaans
  • Català
  • Čeština
  • Deutsch
  • Español
  • Français
  • Hrvatski
  • Indonesia
  • Italiano
  • 日本語
  • Nederlands
  • Norsk
  • Polski
  • Português (BR)
  • Русский
  • Српски
  • Svenska
  • 中文

Keyboard Shortcuts

Site wide shortcuts

s
Focus site search
?
Bring up this help dialog

Commit list

j
Move selected down
k
Move selected up
t
Open tree
p
Open parent
c or o or enter
Open commit

Pull request list

j
Move selected down
k
Move selected up
o or enter
Open issue

Issues

j
Move selected down
k
Move selected up
x
Toggle select target
o or enter
Open issue
I
Mark selected as read
U
Mark selected as unread
e
Close selected
y
Remove selected from view
c
Create issue
l
Create label
i
Back to inbox
u
Back to issues
/
Focus issues search

Network Graph

← or h
Scroll left
→ or l
Scroll right
↑ or k
Scroll up
↓ or j
Scroll down
t
Toggle visibility of head labels
shift ← or shift h
Scroll all the way left
shift → or shift l
Scroll all the way right
shift ↑ or shift k
Scroll all the way up
shift ↓ or shift j
Scroll all the way down