I am trying to open list item attachments in a new tab (when user clicks on an attachment in display form)
I am using this piece of jQuery/javascript in my custom display form to do that:
$(document).ready(function(){
$("table#idAttachmentsTable a").click(function (event) {
event.preventDefault();
var url=$(this).attr('href');
window.open(url, '_blank');
});
});
Now when user clicks on the attachment, it opens in a new tab, but when you close that new tab and return to main tab, it still opens an attachment there (again).
What am I missing to stop it from doing this?
I've tried adding return false;
at the end, but it doesn't change anything