简体   繁体   English

将href添加到锚标记在Internet Explorer中不起作用

[英]adding href to anchor tag not working in internet explorer

I have the below anchor tag defined in ui bootstrap js file. 我在ui bootstrap js文件中定义了以下锚标记。

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

I need to add href tag to the above anchor tag for meeting the accessibility concerns. 我需要将href标签添加到上述锚标签中,以解决可访问性问题。 As that is as part of vendor js file, I cant add href directly there. 由于这是供应商js文件的一部分,因此我无法直接在其中添加href。 Hence I tried to add href attribute using jquery to the above anchor tag as 因此,我尝试使用jquery将href属性添加到上述锚标记中,如下所示:

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

the above line of code worked fine in chrome and firefox but did not work in internet explorer and even the toggle functionality is lost.May I know whether we can get href to the above anchor tag. 上面的代码行在chrome和firefox中工作正常,但在Internet Explorer中不起作用,甚至切换功能也丢失了。

Thanks, Balaji 谢谢,巴拉吉

Use 采用

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

     window.location.href = '#';

});

instead. 代替。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM