You can use .style.display as normal, just make sure when you show it you are using ‘flex’ and not ‘inline’ if the element is a flex!

Hide it:
  document.getElementById('MyId').style.display = 'none';
Show it
  document.getElementById('MyId').style.display = 'inline';
//or
  document.getElementById('MyId').style.display = 'flex';