ActionLink not being hidden

28 Views Asked by At

I have an actionLink that I would to hide whenever I want. Therefore, I set the display to none. However, for some reason, this is not working..

This is the actionlink:

@Html.ActionLink("abc", "TwitterAuth", new { id = "twitterBtn" });

I tried this but did not work:

@Html.ActionLink("abc", "TwitterAuth", new { id = "twitterBtn", style="display:none" });

With Javascript, which gives the erro Uncaught TypeError: Cannot read property 'style' of null:

document.getElementById('twitterBtn').style.display = 'none';

What am I doing wrong please? Because I'm at a loss..

Thanks.

0

There are 0 best solutions below