你好請參考下面的HTML代碼:幫助在jQuery選擇
<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元素中,以便我可以將一些CSS放在文本內容上而不是img元素上。
注意:id爲「content」的div元素是我自己的,我只能使用HTML訪問它。
請幫忙怎麼做?
感謝
我試着用這個var elm = $(「#content p font」)。children(「:not(img)」)。wrap(「
」); – Bhupi 2010-11-03 04:02:53