im currently learning css/js/php
everytime i click the button it shows the div by split second and the hides it again immediately
can someone help
this is the part of the code that im talking about
function showError() {
document.getElementById('error').style.display = "block";
}
<form>
<input type="password">
<div id="error" style="display: none;">Invalid Password</div>
<br/>
<button type="submit" onclick="showError()">LOG IN</button>
</form>