How to get div and full inner content in javascript?
html, javascript
Solution
Use `getElementById()` to get the element and `innerHTML` to get tht content
document.getElementById('content').innerHTML;
LIVE DEMO FOR INNERHTML
To get the content of the whole tag , use `outerHTML`
document.getElementById('content').outerHTML;
LIVE DEMO FOR OUTERHTML
Problem
I want get div inner content in javascript Ex: ``` <div id="content" style="height: 20px; overflow: hidden"> content<br>content<br>content<br> </div> ``` This is my html code. i know only div id (content). but i want retrieved main div and their inner content via javascript like.. ``` <div id="content" style="height: 20px; overflow: hidden"> content<br>content<br>content<br> </div> ``` Also i want retrieved content div attribute also like style, class name etc.