Jhoon Bey Jhoon Bey - 4 months ago 31
HTML Question

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

I meet this interesting situation:

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

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?


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.