Search code examples
javascripthtmlcssasp.net-mvclocation-href

location.href make target appear in status bar when hovering over link


I have the following piece of code which when clicked takes me to the dynamically rendered details page:

<tr class="itemList" onclick="location.href='Details/' + @item.ID">

My only issue is, is that the target URL which would be website/Details/ID doesn't display in the status bar when you hover over the table row and this also means you can't open the link in a new tab (for instance in firefox this status bar appears in the bottom left corner when you hover over a link).

How can I get this target URL to appear in the status bar across different browsers and also be able to open them in new tabs.

Thanks in advance.


Solution

  • A little bit obvious, but still a correct answer in my opinion:

    Use an anchor element, like below.

    <a href="details/your-id">Click me</a>