Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4605142
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:23:31+00:00 2026-05-22T00:23:31+00:00

I have: jquery1.6.min, jquery-tmpl.js (latest beta) and knockout-1.2.0.js. I am using a very simple

  • 0

I have: jquery1.6.min, jquery-tmpl.js (latest beta) and knockout-1.2.0.js. I am using a very simple example but I cannot get jquery templates to render, I cannot figure out why, simply put I can see the elements in the dom by scanning the dom using firebug – I have some tmp=annonymous(jquery,$item) appearing but the data does not render inside the dom.

template:

<script id="bookTemplate" type="text/x-jquery-tmpl">
    <h2>${title}</h2>
    price: ${formatPrice(price)}
</script>

jscode:

<script type="text/javascript">
        $(document).ready(function() {
        // Create an array of books
        var books = [
            { title: "ASP.NET 4 Unleashed", price: 37.79 },
            { title: "ASP.NET MVC Unleashed", price: 44.99 },
            { title: "ASP.NET Kick Start", price: 4.00 },
            { title: "ASP.NET MVC Unleashed iPhone", price: 44.99}];

        function formatPrice(price) {
            return "$" + price.toFixed(2);
        }

        // Render the books using the template
        $('#bookTemplate').tmpl(books).appendTo('#bookContainer');
        });
    </script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:23:32+00:00Added an answer on May 22, 2026 at 12:23 am
    window.formatPrice = function formatPrice(price) {
        return "$" + price.toFixed(2);
    }
    

    Live Example

    Your calling formatPrice in your template but defining the function in your closure. To be able to do this formatPrice has to be in global scope. An easy way to do this is to assign the function to windiw.formatPrice

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use $(button).button(); but jquery-ui-1.8.16.custom.min.js used by SlickGrid doesn't have the button
I have been trying to use localstorage to store Jquery-min but I am unable
I have a strange problem. I have loaded jquery-min javascript in my file. But
I have this Javascript/JQuery code: <script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js></script> <script type=text/javascript> name = $(#name).val(); alert(Name:
I have the following file structure: |- index.html vendor |- jquery.min.js (some libraries) js
I have an aspx page and imports jQuery, jTemplate and Flexigrid <script src=Scripts/jquery-1.4.1.min.js type=text/javascript></script>
OK i have this code HTML: <html> <head> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js> </script> <script type=text/javascript>
Ok, I have this code: <html> <head> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js></script> <script type=text/javascript> function get()
I have this html code <html> <head> <title>JQuery Problem 2</title> <script type=text/javascript src=jquery-1.4.min.js></script> <script
some how i manage to have jquery transfer effect working with jquery dialog but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.