I created a function so that when the button is clicked it will make "barProgress25" appear and "barProgress0" hide from the screen.
However what happens is that when I click on the button it performs the function but after refreshing the page because it sends a submit "barProgress25" and "barProgress0" return to having their original css.
How do I solve this?
HTML code button.
<button type="submit"
id="btnSalvar"
onclick="desabilitaBtn(this.id); exibeBarras();"
class="btnSalvarGreen btnInqBar"
form="FormInquerito"
style="margin-left: 1em;">
SALVAR
</button>
HTML code bar.
<div id="barProgress0" class="progress barProgress">
<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div id="barProgress25" class="progress barProgress">
<div class="progress-bar" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">25%</div>
</div>
Code function.
function exibeBarras(visivel) {
if (visivel == undefined) {
visivel = true;
}
if (visivel) {
document.getElementById("barProgress25").style.display = "block";
document.getElementById("barProgress0").style.display = "none";
}
}