========第一种方法==============
Title添加
标题1标题2标题3
$(function () {
$("#add").click(function () {
$("#table tbody").append(`
`)})
})
===========第二种方法=============
Title添加
标题1标题2标题3
$(function () {
$("#add").click(function () {
$("#table tbody").append('
')$("#table td").on('paste',function (e){
var that = e
setTimeout(function (){
that.currentTarget.innerHTML = that.currentTarget.innerHTML.replace( /]*>/g, "" );
})
})
})
})
=============第三种方法===============
$(".page3-emjoy5").on("paste", function (e) {
textInit(e)
});
function textInit(e) {
e.preventDefault();
var text;
var clp = (e.originalEvent || e).clipboardData;
if (clp === undefined || clp === null) {
text = window.clipboardData.getData("text") || "";
if (text !== "") {
if (window.getSelection) {
var newNode = document.createElement("span");
newNode.innerHTML = text;
window.getSelection().getRangeAt(0).insertNode(newNode);
} else {
document.selection.createRange().pasteHTML(text);
}
}
} else {
text = clp.getData('text/plain') || "";
if (text !== "") {
document.execCommand('insertText', false, text);
}
}
}