I've got two links that I need to hide/remove with javascript. All my attempts to do so have failed. The anchors are defined inside of a <td>
like this:
<td>
<a id="btnReplaceAll" onclick="LaunchUploader(this, true);this.blur();return false;" href="javascript:void(0);" class="btnMed"><span>Replace All</span> </a>
</td>
First I tried the obvious:
document.getElementById('btnReplaceAll').style.display = 'none';
document.getElementById('btnRetainAll').style.display = 'none';
But they still show up. Then I tried this:
var btnReplaceAll = document.getElementById('btnReplaceAll');
var btnRetainAll = document.getElementById('btnRetainAll');
btnReplaceAll.parentNode.removeChild(btnReplaceAll);
btnRetainAll.parentNode.removeChild(btnRetainAll);
How do I get rid of these things with javascript? Please, no jQuery.
Problem was duplicate IDs. There were elements defined with the same IDs in another file but the files all get assembled by .net so I didn't notice the duplication.