问题
I'm using Jade in my latest node.js app. I'd like to have a long block of text in a textarea by default.
If I do something like this:
textarea(id="theTextarea")
it renders just fine:
<textarea id="theTextarea"></textarea>
However, if I do something like so:
textarea(id="theTextarea")
Hello world.
I get this:
<textarea id="theTextarea">
<hello>world</hello>
</textarea>
But I'd like it to be like so:
<textarea id="theTextarea">
hello, world
</textarea>
Any ideas?
回答1:
textarea(id="theTextarea")
| Hello
| world.
| Hello
| moon.
| Hello
| sun.
回答2:
The | worked great for me. In my case though, I needed to get the value from a js variable (passed via render local variables). This is what I ended up with:
textarea#resp( name="resp", rows="6", cols="66" )
| #{respStr}
I hope that helps someone.
回答3:
You can also do this, if you don't want a lot of pipes "clogging up" your markup (notice the dot character after the closing parens):
textarea(id="theTextarea").
Hello
world.
Hello
moon.
Hello
sun.
Read through the Tag Text section in the Jade docs for more information.
来源:https://stackoverflow.com/questions/10659775/long-block-of-text-in-jade-textarea