简体   繁体   中英

Is it possible to change variable from view in JavaScript? (Node.js)

I want to create some var in my JADE view in Node.js application, for example:

- var MyVariable = ''

And when i click on the button:

button(onclick="show('#{item._id}')")

I want to change MyVariable to value of item._id

function show(partner_id){
        MyVariable = partner_id
        }

Unfortunately, the code above won't work

Where are you passing item to the jade template? You should be able to simply assign MyVariable in the same place.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM