Hi please refer the following HTML code:
<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>
this is the html code which is being generated from admin section of my web application. I can't modify it and also can't change the structure of the above code. it is generating dynamically.
I need to wrap the text content in a html element using jquery wrap() method so that I can put some css on the text content and not on img element.
Note: The div element with id "content" is my own, I can access only this using HTML.
Please help how to do this?
Thanks
Here is the jQuery way
You can Demo it here http://www.jsfiddle.net/K8WNR/
Not sure if you can do that with jQuery. But if you use raw JavaScript, you can look through the nodes and check out their
nodeType
, with 1 being Element and 3 being Text. So sayf
is your font element:You could try this ...
Which will return this ...