u may want to get its parent's inner html and replace the node's inner html with it:
<div id="MainDiv">
<div id="D1">
asdasd
</div>
</div>
<script>
TheHtml1=document.getElementById("D1").innerHTML
TheHtml2=document.getElementById("MainDiv").innerHTML
TheHtml2=TheHtml2.replace(TheHtml1,"")
alert(TheHtml2)
</script>
Thanks, but this won't work. The parent node may include much more than just the image, and this is not under my control. For example, in the following, the parent is a <td> element but there is much more than the image inside.
<td><a>some link</a><img src = someSource propertyA = 'someProperty' propertyB = 'otherProperty'> some text </td>
Sorry vbkris, as I said, the html code is not under my control. I write the JS function to serve a general purpose and work on images identified by their id's, no matter how they are embedded in their html page.
The suggestion by vongrunt seems to be the right solution. Thanks, I'll try it.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.