Jhoon Bey Jhoon Bey - 23 days ago 7
HTML Question

<a> link not working by clicking, only work by "Open link in new tab" command

I meet this interesting situation:

<ul>
@foreach (var item in Model)
{
<li>
<a href="@Url.Action("Details", "Product", new { id = item.Id })" >@item.Name</a>
</li>
}
</ul>


When I click a link, nothing happen, product Details page does not open. But I do "Open link in new tab", then it opens. What can be it's reason?

Answer

You have some javascript code which is preventing the default action of the anchor tag to be executed. You could inspect the Network tab in FireBug to see if some AJAX request is being made when you click on the link. You could try excluding javascript files until you find the one that is doing this.