gpt4 book ai didi

asp.net-mvc - 使用 MVC 在 contentEditable DIV 中发布 HTML

转载 作者:行者123 更新时间:2023-12-04 20:03:00 25 4
gpt4 key购买 nike

我可以直接发布 contentEditable DIV 的内容吗?我唯一能想到的就是将 innerHtml 复制到隐藏的输入元素中,但我确信必须有更直接的方法。

查看:

<div name="typer" id="typer" onclick="eraseFirst();this.contentEditable='true';">
Text here that the user typed, with html elements. How is this posted?
</div>

Controller :

[HttpPost]
public ActionResult BlogPage(BlogsPosts blogsposts)
{
// Is this a good start?
return View(blogsposts);
}

最佳答案

您将需要使用 javascript 来解析文本,并在提交表单之前填充作为 View 模型一部分的隐藏字段,或者通过 ajax 发送请求。

关于asp.net-mvc - 使用 MVC 在 contentEditable DIV 中发布 HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11962618/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com