javascript - jQuery: pasting contents as plain text -


using information on internet, got far:

http://codepen.io/anon/pen/eeofw

$('textarea').bind('paste', function () {   var element = this;   settimeout(function () {     var text = $(element).val();         console.log("paste")   }, 100); }); 

it seems work fine, wondering event can trigger put "clean" version of pasted text text area instead of copied contents. includes if text pasted html, word or other sources. there way strip out tags , such without hassle? i'm guessing i'm looking kind of regex solution haven't been able find one.

put styled content hidden div, , retrieve innertext. if styled content in text:

a=document.createelement('div'); a.innerhtml=text; b=a.innertext; 

Comments

Popular posts from this blog

How to logout from a login page in asp.net -

Stack level too deep error after upgrade to rails 3.2 and ruby 1.9.3 -