html - How to get div and full inner content in javascript? -


i want div inner content in javascript

ex:

<div id="content" style="height: 20px; overflow: hidden">   content<br>content<br>content<br> </div> 

this html code. know div id (content). want retrieved main div , inner content via javascript like..

<div id="content" style="height: 20px; overflow: hidden">  content<br>content<br>content<br> </div> 

also want retrieved content div attribute style, class name etc.

use getelementbyid() element , innerhtml tht content

document.getelementbyid('content').innerhtml; 

live demo innerhtml

to content of whole tag , use outerhtml

document.getelementbyid('content').outerhtml; 

live demo outerhtml


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -