简体   繁体   中英

Jade: text box change the value = “ …”

I am extremely beginner in Jade and Html and I am trying to build a form in Jade. The problem I am having is with a basic text box as follows:

input(type='text', name='sessionID', value = 'valueID')

When I need to modify sessionID in my code, I just do sessionID = //some command. But that does not work for valueID = //some command.

Is it possible to change in any way the valueID ?

It looks like jade is just picky about value.

input(type='text', name='sessionID', value=valueID)

forces it to use valueID as a variable

I made a working case here: http://runnable.com/UWekeMufwudHAACH

jade is just a templating language that produces static html, it doesn't bind data the objects. If you want to change the value of an html tag, you need to use javascript and select the element and then update it's value.

document.querySelector('input[name=sessionID]').value = 'some new value';

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