SP2013 Document Library - Open pdf in a new tab when library items grouped

Copper Contributor

Hi,

I am using the code snippet below to ensure pdf files in a SharePoint 2013 document library open in a new tab.

 

This code works fine until files in the document library are grouped. Can someone please help tweak the code so I can ensure that pdf files in a 'grouped' library also open in new tabs?

 

 

<script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>

    <script type="text/javascript">

        $(function () {

            $("a[href$='.pdf']").removeAttr("onclick");

            $("a[href$='.pdf']").removeAttr("onmousedown");

            $("a[href$='.pdf']").attr("target", "_blank");       

        });

    </script>

 

 

Thanks in advance

0 Replies