var button = document.getElementById('BtnNextInsured'); // Assumes element with id='button'
button.onclick = function() {
var div = document.getElementById('tblContact');
if (div.style.display !== 'none') {
div.style.display = 'none';
} else {
div.style.display = 'block';
}
};
<button id="BtnNextInsured" class="btn btn-md btn-primary">Next</button> Table to show:
<table id="tblContact" class="table table-light table-borderless" style="display:none;">
<tr>
<td class="cellContent">
<input id="txtEmail" class="txt" placeholder="Email" />
</td>
<td class="cellContent">
<input id="txtCell" class="txt" placeholder="Cell Phone" />
</td>
<td class="cellContent">
<input id="txtLandline" class="txt" placeholder="Landline" />
</td>
</tr>
<tr>
<td colspan="3" style="text-align: right">
<button id="BtnNextContact" class="btn btn-md btn-primary">Next</button>
</td>
</tr>
</table>
I don’t understand wha’ts wrong with my code, I am a beginner to javascript. Kindly help, thank you.


