如何移除指定id的span的内容?
以下span是由js生成的:
document.getElementById( "filelist ").insertAdjacentHTML( "beforeEnd ", ' <span id= "f_0 "> <a href= "./a.aspx?id=1 "> 一行 </a> </span> <span id= "f_0 "> 删除 </span> ');
<div id= "filelist ">
<span id= "f_0 "> <a href= "./a.asp?id=1 "> 一行 </a> </span> <span id= "f_0 "> 删除 </span>
<span id= "f_1 "> <a href= "./a.asp?id=2 "> 一行 </a> </span> <span id= "f_1 "> 删除 </span>
<span id= "f_2 "> <a href= "./a.asp?id=3 "> 一行 </a> </span> <span id= "f_2 "> 删除 </span>
<span id= "f_3 "> <a href= "./a.asp?id=4 "> 一行 </a> </span> <span id= "f_3 "> 删除 </span>
</div>
如何实现,点击“一行”的时候,则将id= "file_0 "的span标签去掉。其它行同理。
------解决方案--------------------document.getElementById( "file_0 ").parentNode.removeChild(document.getElementById( "file_0 "))