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

查看:62
本文介绍了< 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天全站免登陆