Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get values between DIV tags?

Tags:

javascript

How do I get the values in between a DIV tag?

Example

<div id="myOutput" class="wmd-output">
    <pre><code><p>hello world!</p></code></pre>
</div>

my output values I should get is

<pre><code><p>hello world!</p></pre>
like image 666
001 Avatar asked Jun 12 '10 04:06

001


1 Answers

First, find the element. The fastest way is by ID. Next, use innerHTML to get the HTML content of the element.

document.getElementById('myOutput').innerHTML;
like image 173
meagar Avatar answered Sep 20 '22 01:09

meagar