---
title: "Discussion on \"在富文本编辑框中复制粘贴时去掉html格式\" | Hashnode"
description: "Discussion on \"在富文本编辑框中复制粘贴时去掉html格式\". document.querySelector(\"div.pasteEditor\").addEventListener(\"paste\", function(e) { e.preventDefault(); var text = e.clipboardData.getData(\"text/plain\"); document.execCommand(\"insertText\", false, text); });"
url: "https://hashnode.com/posts/html/64ed99e6571f0e686482b7b6"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [在富文本编辑框中复制粘贴时去掉html格式](https://zmblog.hashnode.dev/html?utm_source=hashnode&utm_medium=feed)

document.querySelector("div.pasteEditor").addEventListener("paste", function(e) { e.preventDefault(); var text = e.clipboardData.getData("text/plain"); document.execCommand("insertText", false, text); });

Aug 29, 2023 · 1 min read · zmblog.hashnode.dev  
Read the article

## Written by

[明](https://hashnode.com/@zm144)

@zm144

  
[View profile](https://hashnode.com/@zm144)

learn

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
