【发布时间】:2011-09-09 23:36:04
【问题描述】:
您好,请参考以下 HTML 代码:
<div id="content">
<p>
<font size='2'>
<img src="something.jpg" width="500" height="500" />
this is the text content. this is the text content. this is the text content...
</font>
</p>
</div>
这是从我的 Web 应用程序的管理部分生成的 html 代码。我不能修改它,也不能改变上面代码的结构。它是动态生成的。
我需要使用 jquery wrap() 方法将文本内容包装在一个 html 元素中,这样我就可以在文本内容上而不是在 img 元素上放置一些 css。
注意:id 为“content”的 div 元素是我自己的,我只能使用 HTML 访问它。
请帮忙怎么做?
谢谢
【问题讨论】:
-
我试过这个 var elm = $("#content p font").children(":not(img)").wrap("");
标签: javascript jquery html css jquery-selectors