After implementing a function that should display "barProgress25" and hide "barProgress0" when a button is clicked, I encountered an issue. Upon clicking the button, the function works as intended but upon page refresh, "barProgress25" and "barProgress0" revert back to their original CSS states.
How can I fix this problem?
Button HTML code.
<button type="submit"
id="btnSalvar"
onclick="desabilitaBtn(this.id); exibeBarras();"
class="btnSalvarGreen btnInqBar"
form="FormInquerito"
style="margin-left: 1em;">
SAVE
</button>
Bar HTML code.
<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>
Function code.
function exibeBarras(visivel) {
if (visivel == undefined) {
visivel = true;
}
if (visivel) {
document.getElementById("barProgress25").style.display = "block";
document.getElementById("barProgress0").style.display = "none";
}
}