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 7577797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:16:46+00:00 2026-05-30T17:16:46+00:00

I have a Jade page like so: table th Site Name th Deadline th

  • 0

I have a Jade page like so:

table
    th Site Name
    th Deadline
    th Delete Transaction

    - if (transactions != null)
        each item in transactions
            tr
                td= item.item_name
                td
                    span(id='countdown' + item.timeout + ')= item.timeout
                td
                    span(style='cursor: pointer;', onclick='deleteTransaction("=item.uniqueId")')= "X"

            button(id='confirmButton', onclick='confirm();')Confirm

As you can see in both the span attribute I try to put a local variable in two different ways and it doesn’t work. Concerning the first way, I receive a token ILLEGAL error, while the second simply writes in my JavaScript something like deleteTransaction("=item.uniqueId");. I know the answer is something really stupid, but again and again Jade doc (even if it has improved) doesn’t help me.

Thanks

  • 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-30T17:16:47+00:00Added an answer on May 30, 2026 at 5:16 pm

    To quote the docs:

    Suppose we have the user local { id: 12, name: 'tobi' } and we wish to create an anchor tag with href pointing to “/user/12” we could use regular javascript concatenation:

    a(href='/user/' + user.id)= user.name
    

    Ergo:

    span(id='countdown' + item.timeout)= item.timeout
    
    // ...
    
    span(style='cursor: pointer;', onclick='deleteTransaction("' + item.uniqueId + '")')= "X"
    

    Quoting again:

    or we could use jade’s interpolation, which I added because everyone using Ruby or CoffeeScript seems to think this is legal js..:

    a(href='/user/#{user.id}')= user.name
    

    And so:

    span(style='cursor: pointer;', onclick='deleteTransaction("#{item.uniqueId}")')= "X"
    

    As a general tip that you’ll use every day of your programming life: balance your quotes. Just like brackets and parentheses, every quotation mark must either open a new quotation or close an already-open quotation (of the same kind, i.e. double-quotes close double-quotes, single-quotes close single-quotes). To borrow your code:

    span(id='countdown' + item.timeout + ')= item.timeout
      //                                 ^
      //                                 |
      // What's this guy doing? ---------+
    

    Even though Jade is a templating language and perhaps not a “real” programming language this rule, just as in HTML (also not a programming language), will serve you well.

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

Sidebar

Related Questions

I have this jade file: - if (transactions != undefined) table th Site Name
I have this piece of code in one of my .jade files: each item
I have the following HTML structure: (jade template language) #review-item-1.review-item a.submit-review-toggle(href=#).review-item-toggle + h3 Service
I have a jade template for my node.js project. I would like to send
I'd like to do something like the following within a jade template. include page-content/#{view.template}
I have a Node.js/Jade-based site and I'm trying to add some interactivity with some
Have just started using Google Chrome , and noticed in parts of our site,
I have a blog. On the individual post page I want to display a
I have created a makefile for the generation of a simple web page. The
I have layout.jade: html include includes/head body header h1 Jumplink design p web design+creative

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.