【发布时间】:2019-02-24 19:01:55
【问题描述】:
由于我一直搜索并没有找到适合我的答案,我希望你能帮助我。顺便说一句,我是编码新手!
我正在为我姐姐建立一个招聘网站,她可以在其中上传工作机会。对于描述,我使用了<textarea> 标签。我读到它无法解释 html 标签,不幸的是,这是真的。我希望我姐姐至少能够换行,因为the text looks like this。
我尝试了许多富文本编辑器,例如 CKEditor,但最终在编辑器中看起来不错,但输出保持不变!我也试过div标签,但他们不会提交到我的数据库...
我正在使用 HTML、CSS、JavaScript、NodeJS 和 EJS。我不知道它是否有帮助,但我会把我的 ejs 文件放在这里:
<% include ./partials/header %>
<div class="ui violet segment"><h1>Stelle bearbeiten: <%= job.title %></h1>
<div class="ui divider"></div>
<div style="padding:20px 0; width: 50%;">
<form class="ui form" action="/admin/jobs/<%= job.id %>?_method=PUT" method="POST">
<div class="field">
<label>Titel</label>
<input type="text" name="title" value="<%= job.title %>">
</div>
<div class="field">
<label>Beschreibung</label>
<textarea name="description"><%= job.description %></textarea>
</div>
<div class="field">
<label>Ort</label>
<input type="text" name="location" value="<%= job.location %>">
</div>
<div class="inline fields">
<label for="jobtype">Art</label>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="jobtype"
<% if(job.jobtype === 'Freelancer'){ %>
checked="checked"
<% } %>
value="Freelancer">
<label>Freelance</label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="jobtype"
<% if(job.jobtype === 'Festanstellung'){ %>
checked="checked"
<% } %>
value="Festanstellung">
<label>Festanstellung</label>
</div>
</div>
</div>
<div class="field">
<label>Zeitraum</label>
<input type="text" name="time" value="<%= job.time %>">
</div>
<div class="inline fields">
<label for="status">Status</label>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="status"
<% if(job.status === 'active'){ %>
checked="checked"
<% } %>
value="active">
<label>veröffentlicht</label>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="status"
<% if(job.status === 'inactive'){ %>
checked="checked"
<% } %>
value="inactive">
<label>geheim</label>
</div>
</div>
</div>
<button class="ui teal button">Speichern</button>
</form>
</div>
</div>
<% include ./partials/footer %>
提前致谢!
【问题讨论】:
-
不确定是什么问题?您可以获取
<texarea>的.value并将该HTML 字符串附加到<textarea>之外的HTML 元素 -
绝望一周后,我发现了真正的问题,the answer to my problem
标签: javascript html textarea line-breaks richtext