如何强制手风琴 header 中的超链接在新选项卡中打开?

How to force the hyperlink in an accordion's header to get opened in a new tab?

我在我的代码中使用 JQuery 手风琴。一些 headers 在手风琴中有一些 hyperlinks。 hyperlink 正在运行,但我希望它们在新选项卡中打开。我在检查元素时可以看到 target="_blank" 属性,但它不起作用!!! 当我单击手风琴 header 中的 hyperlink 时,如何强制 link 在新选项卡中打开?这是我的代码:

 <script type="text/javascript">
    $(function() {
        $( "#accordion" ).accordion(
                {
                    active: 0,
                    header:"h4",
                    collapsible: true,
                    heightStyle: "content",
                    navigation: true,
                    beforeActivate: function(event, ui) {
                        if (ui.newHeader[0]) {
                            var currHeader  = ui.newHeader;
                            var currContent = currHeader.next('.ui-accordion-content');
                        } else {
                            var currHeader  = ui.oldHeader;
                            var currContent = currHeader.next('.ui-accordion-content');
                        }
                        var isPanelSelected = currHeader.attr('aria-selected') == 'true';
                        currHeader.toggleClass('ui-corner-all',isPanelSelected).toggleClass('accordion-header-active ui-state-active ui-corner-top',!isPanelSelected).attr('aria-selected',((!isPanelSelected).toString()));

                        currHeader.children('.ui-icon').toggleClass('ui-icon-triangle-1-e',isPanelSelected).toggleClass('ui-icon-triangle-1-s',!isPanelSelected);

                        currContent.toggleClass('accordion-content-active',!isPanelSelected);
                        if (isPanelSelected) { currContent.slideUp(); }  else { currContent.slideDown(); }

                        return false;
                    }
                }
        );
        //capture the click on a link in the accordion header
        $("#accordion").find("h4 a").click(function() {
            window.location = $(this).prop('href');
            return false;
        });
    });
</script>

尝试:

window.open($(this).prop('href'));

但是,您无法在 window 和制表符

之间进行选择