Hide and display HTML element using Javascript

Within the JavaScript of your SAP BSP application or standard web page it is very simple to toggle a HTML element between hidden and display mode using the visibility attribute. You would just reference the elements ID and set the visibility attribute to ‘hidden’ or ‘visible’, see example below.

HTML Code:

<a id=”myBackButton” href=”?OnInputProcessing(goback)” class=”myButton”  >Back to Index</a>

JavaScript Code:

document.getElementById(‘myBackButton’).style.visibility = ‘hidden’;
document.getElementById(‘myBackButton’).style.visibility = ‘visible’;

Leave a Comment: