getting all textnodes in a frame
- Hi,
I'm trying to get all textnodes in an iframe, like this:
- $("*", $(frame).contents()).each(function(){
- if($(this).nodeType==3)
- $(this) .wrap(<span/>);
- });
But it seems not to be Working as I get only nodes type 1.
I have some elements like this:
- <span><span>this is a node type 1</span>this a text node</span>
- I want the elements not to have any textnodes as childnodes. i.e., If an element has children, I want all those children to be type 1.
- I want the above element to be:
- <span><span>this is a node type 1</span><span>this a text node </span> </span>
Thanks,
Regards