0
<div id='Thirdsamplecodesnippet' class='clearfix'>
<pre class='brush:html;'>&lt;html&gt;
&lt;body&gt;
&lt;p&gt;Hello world.&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<input type='hidden' id='codeid' value='process'>  
</div>

我想从 div 中提取这个:

<pre class='brush:html;'>&lt;html&gt;
&lt;body&gt;
&lt;p&gt;Hello world.&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>

使用 jQuery 怎么可能?

4

1 回答 1

3

div带有 id的父级的 htmlThirdsamplecodesnippet就是您所需要的。您可以使用 jQuery 的 id选择器来获取父 div jQuery 对象并在其上调用html()函数。

现场演示

$('#Thirdsamplecodesnippet').html()
于 2013-01-05T13:00:52.747 回答