【问题标题】:adding href to anchor tag not working in internet explorer将 href 添加到锚标记在 Internet Explorer 中不起作用
【发布时间】:2015-12-07 01:11:29
【问题描述】:

我在 ui bootstrap js 文件中定义了以下锚标记。

    <a class="accordion-toggle" ng-click="toggleOpen()" accordion-      
   transclude="heading">

我需要在上面的锚标记中添加 href 标记以满足可访问性问题。 由于这是供应商 js 文件的一部分,因此我无法直接在此处添加 href。 因此,我尝试使用 jquery 将 href 属性添加到上述锚标记作为

    $('.accordion-toggle').attr('href', '#')

上述代码行在 chrome 和 firefox 中运行良好,但在 Internet Explorer 中无法运行,甚至切换功能也丢失了。请问我们是否可以获取上述锚标记的 href。

谢谢, 巴拉吉

【问题讨论】:

  • 在使用angular时为什么要通过jquery添加锚标签?
  • 是的,我也可以使用 angular 来实现,但我的问题是我可以添加 href 属性,但是在 Internet Explorer 中,切换功能在 Internet Explorer 中受到影响
  • 页面上是否有多个 .accordion-toggle 元素?
  • 它是 Angular 引导程序吗?它非常灵活。您可以将 $templteCache 中的任何 tpl 替换为您自己的。
  • 哦对了,我试试,谢谢你的回复

标签: javascript jquery angularjs internet-explorer


【解决方案1】:

使用

$('.accordion-toggle').click(function() {

     window.location.href = '#';

});

改为。

【讨论】:

    猜你喜欢
    • 2015-12-07
    • 2015-07-24
    • 2017-04-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-04
    • 1970-01-01
    • 2010-11-10
    相关资源
    最近更新 更多