Skip to content

tiger986/inputPasteContent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Copy paste filter label (can retain the specified label)

HTML code

<div class="con" contenteditable="true"></div>

JS code

$(".con").bind("paste", function(){
    var _this = $(this);
    setTimeout(function(){				
        var con = _this.html();				
        var i, match;
        match = con.match(/<[^>]+>/gi);
	if (match) {
	    for (i in match) {
	        if (!match[i].match(/<(input|div|br).*?(?:>|\/>)/gi)) {
	            con = con.replace(match[i], '');
	        }
	    }
	}
	match = con.match(/{[^}]+}/gi);
	if (match) {
	    for (i in match) {
	        if (!match[i].match(/<(input|div|br).*?(?:>|\/>)/gi)) {
	            con = con.replace(match[i], '');
	        }
	    }
	}
        _this.html(con);
    }, 30)
})

About

Copy paste filter label (can retain the specified label)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages