I have a forms library with a few Infopath forms in them. I want to make it so that clicking on the form will open it in a new window/tab. I have added a CEWP with Javascript to give the hyperlinks the target blank attribute, but they still continue to open in the same window.

<script type="text/javascript">
    $('#onetidDoclibViewTbl0 a').attr('target', '_blank');}

1 Answer 1


Never mind I figured it out. There was an onclick function for the hyperlinks that was causing it to open in the same window. I followed the instructions from this post and fixed it.

Opening a document in a SharePoint 2013 document library in a new tab (using code)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.