Sorry, if the title is too obscure ;D.
Actually the problem is, lets say i am this code.
<span id="spanIDxx" style="blah-blah">
<tag1>code here </tag2> sample text
<tag2>code here </tag2> html aass hhddll
sample text
</span>
Now if i will use the code.
jQuery("#spanIDxx").html();
then it will return just the innerHTML excluding <span id="spanIDxx" style="blah-blah">
but i want something which can return the innerHTML including the specified element.
This will create a new
divand append a clone of your element to thatdiv. The newdivnever gets inserted into the DOM, so it doesn’t affect your page.If you need to use this frequently, and don’t want to bother with adding yet another plugin, just make it into a function:
Or extend jQuery yourself: