<a>链接无法通过单击工作,只能通过“在新标签中打开链接"来工作;命令 [英] <a> link not working by clicking, only work by "Open link in new tab" command

查看:13
本文介绍了<a>链接无法通过单击工作,只能通过“在新标签中打开链接"来工作;命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了这个有趣的情况:

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?

推荐答案

您有一些 javascript 代码阻止执行锚标记的默认操作.您可以检查 FireBug 或 Chrome DevTools 中的 Network 选项卡,以查看当您单击链接时是否正在发出某些 AJAX 请求.您可以尝试排除 javascript 文件,直到找到执行此操作的文件.

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 or Chrome DevTools 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.

这篇关于&lt;a&gt;链接无法通过单击工作,只能通过“在新标签中打开链接"来工作;命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆