【发布时间】:2011-09-26 12:51:41
【问题描述】:
我有以下html
<img src="a.jpg" /><p> This is some random text and just to test this example. This is some random text and just to test this example. This is some random text and just to test this example<p>
<br><p>This is some random text and just to test this example This is some random text and just to test this example</p>
<img src="a.jpg" />
<br><p>This is some random text and just to test this example This is some random text and just to test this example</p>
我的问题是,如果我必须只使用 jquery 来预览文本,假设我在一个名为 html 的变量中有这个,如何只显示文本的几个部分而忽略图像
<div id="preview"></div>
$("#preview").val("//display only text in the variable named html")
【问题讨论】:
-
hi rajeev .. 好名字你有:-) 你的问题不太清楚。我认为您希望通过从 html div 获取另一个 div 的价值。我对吗 ?然后使用这个 $("#preview").html("//只显示名为 html 的变量中的文本")
标签: javascript jquery jquery-selectors jquery-validate