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

  • Home
  • SEARCH
  • 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 8730551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:02:54+00:00 2026-06-13T09:02:54+00:00

have a javascript function as follows: function test(item) { var DataToBeShownOnScreen = jQuery.data(document.body, DataTobeShown);

  • 0

have a javascript function as follows:

function test(item) {
       var DataToBeShownOnScreen = jQuery.data(document.body, "DataTobeShown");
       var found = $.inArray(item, DataToBeShownOnScreen) > -1;
       return found;
}

and I need to call this function in my jquery template as follows:

<script id="GridTemplate" type="text/html">
     <tbody>            
         {{each Data}} 
             <tr>
               {{each $value}} 
               {{if ${test($index)} }}                   
                   <td>${$value}</td>
               {{/if}}
               {{/each}}
             </tr>
          {{/each}} 
     </tbody>
</script>

But I am getting error:

expected identifier, string or number

I want help in understanding what is the mistake i am doing in the call of function test in the {{if}} of my template.

  • 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-06-13T09:02:55+00:00Added an answer on June 13, 2026 at 9:02 am

    I was able to resolve this by using {{if test($index)}} instead of {{if ${test($index)}}}.

    The problem I guess was ${test($index)} would output a string rather than giving true or false as bool. Removing ${} around the function meant that I actually get the bool value.

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

Sidebar

Related Questions

I have a Javascript object created as follows: var ccStatTracker = (function (){ ccmap:{
'Hi I am calling a web service from javascript/jquery as follows: function Test(userid) {
in .gsp file i have javaScript function <script type=text/javascript> function getCurrentItemNumber(){ return document.getElementById('item_itemNumber').innerHTML.substr(6); }
When using Javascript as follows: function Test(Example) { } Test.prototype.etc etc etc function Example()
I have this simple javascript function which changes the body zoom of the web
I have defined my JavaScript function as follows: function printCompanyName(company1, company2, company3, company4, company5)
I've got follow source code: <html> <head><script type=text/javascript> function test() { var links =
I have been testing the jQuery .html() function and I have found that it
I have this follow code in my javascript. I call this function when the
I have Javascript function defined in the main index.html file. One part of this

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.