Hide a tab from detail view

I need to hide a tab from details view but the display function isn´t working and should appear in the next line of code

document.querySelector(‘li a#tab1’)?.closest(‘li’).remove();