It seems it could be written shorter. It's especially annoying when I have to do this in multiple languages, so the button labels will be different.
<button id="egyes" class="btn btn-danger">Hide</button> some text
<button id="kettes" class="btn btn-warning">Hide</button> other text
<button id="harmas" class="btn btn-info">Hide</button> some more text
<button id="otos" class="btn btn-success">Hide</button> last button
<button id="showall" class="btn">Show all</button>
<script>
$(document).ready(function() {
$("#egyes").click( function() {
$("div.progress-danger").parent().fadeToggle();
if ($(this).html() == "Show") {
$(this).html("Hide");
} else {
$(this).html("Show");
}
});
$("#kettes").click( function() {
$("div.progress-warning").parent().fadeToggle();
if ($(this).html() == "Show") {
$(this).html("Hide");
} else {
$(this).html("Show");
}
});
$("#harmas").click( function() {
$("div.progress-info").parent().fadeToggle();
if ($(this).html() == "Show") {
$(this).html("Hide");
} else {
$(this).html("Show");
}
});
$("#otos").click( function() {
$("div.progress-success").parent().fadeToggle();
if ($(this).html() == "Show") {
$(this).html("Hide");
} else {
$(this).html("Show");
}
});
$("#showall").click( function() {
$("div.container > div > div.progress").parent().fadeIn();
});
});
</script>