Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我在 contenteditable 区域中按“输入”时,<div>会生成一个新的我想添加的<br />标签。我该如何操纵这种行为。它是如何在 WYMeditor 中完成的。preventdefault()除了和处理它还有其他方法吗?
<div>
<br />
preventdefault()
不,这就是它的完成方式。在 IE 中,您需要将事件的returnValue属性设置为false而不是调用preventDefault()(注意中间的大写 D)。
returnValue
false
preventDefault()