javascript - How to get HTML DIV value -


i'm trying screen shot paste in website using firefox. can done giving div contenteditable='true'.

html

<html> <head> <title>screen shot example</title> <style type="text/css"> #apdiv1 {     position:absolute;     width:258px;     height:165px;     z-index:1;     left: 71px;     top: 59px; } </style> </head>  <body> <div id="apdiv1" contenteditable='true'>paste test</div> </body> </html>  

i can paste images clipboard particular div. issue starts, how value div. example user paste screenshot in div , want save in db. if normal textbox can textbox value. there way can convert div image. advice , referral links highly appreciated.

document.addeventlistener('domcontentloaded', function(){      var text = document.getelementbyid('apdiv1').innertext; }, false); 

to replace div:

document.addeventlistener('domcontentloaded', function(){      var el = document.getelementbyid("apdiv1");     var img = document.createelement("img");     img.setattribute('src', '...');     el.parentnode.replacechild(el, img); }, false); 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -