you can test the visible property
$(".answer-button").click(function(){
$(this).prev().toggle();
if($(this).parent().find('#answer').is(':visible')){
$(this).html("Hide Answer");
}else{
$(this).html("Show Answer");
}
});
CLICK HERE to find out more related problems solutions.