html - Invisible anchors can't be removed with javascript -


this question has answer here:

i've got 2 links need hide/remove javascript. attempts have failed. anchors defined inside of <td> 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 tried obvious:

document.getelementbyid('btnreplaceall').style.display = 'none'; document.getelementbyid('btnretainall').style.display = 'none'; 

but still show up. tried this:

var btnreplaceall = document.getelementbyid('btnreplaceall'); var btnretainall = document.getelementbyid('btnretainall'); btnreplaceall.parentnode.removechild(btnreplaceall); btnretainall.parentnode.removechild(btnretainall); 

how rid of these things javascript? please, no jquery.

problem duplicate ids. there elements defined same ids in file files assembled .net didn't notice duplication.

are trying remove them, or hide them?

if want remove them, should work:

var btnreplaceall = document.getelementbyid('btnreplaceall'); btnreplaceall.parentnode.removechild(btnreplaceall); var btnretainall = document.getelementbyid('btnretainall'); btnretainall.parentnode.removechild(btnretainall); 

it looks tried though.

which means, have other javascript adding them in take them out. try adding throw new error() after line test. if disappear line after block above, stay without it, means putting them right in.

it seem same deal if want hide them, since have should hiding.

also, may seem obvious, double-check ids using ids set (double-check character case , stuff well).

additionally, if in iframe isn't same place trying removal code, won't work well. can check outputting console.log(btnreplaceall) (after set variable) , make sure non-null.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

c++ - End of file on pipe magic during open -