Instead of
targetElement.style.display = '';
you've got to write
targetElement.style.display = 'block';
In the 'if', you've got to check if you've established the display to block. If you haven't, the elment will be invisible (as set by the CSS rule):
if (targetElement.style.display == 'block') {
If you set display: none in CSS, doing .style.display = '' means that you're 'erasing' the inline value (which takes precedence over the value in a CSS file). So, by doing this, the new value for display will be 'none', as set in the CSS. By setting it to 'block', the final value of display is block.
I suggest you to read something about how CSS rules are applied.