【发布时间】:2020-11-07 09:29:50
【问题描述】:
我想为输入字段赋值。当我console.log 时,我得到了输出,因为标题很适合应用程序。内容是你好世界。但是只有 Welcome 被分配给标题输入,只有 hello 被分配给内容输入。仅分配第一个单词。请帮忙。
post.ejs
<%- include('./partials/header');-%>
<%- include('./partials/flash');-%>
<form action="/posts/<%= post._id %>/edited" method="POST">
<%= console.log("title is "+post.Title +" ."+"content is "+post.Content); %>
<h1><input type="text" name="title" id="title" value=<%= post.Title %>></h1>
<p><input type="text" name="content" id="content" value=<%= post.Content %>></p>
<button class="btn btn-primary" type="submit">Publish</button>
</form>
<%- include('./partials/footer');-%>
【问题讨论】:
标签: node.js mongodb express mongoose ejs