change html with a jquery click and then revert back to the original html

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.

Leave a Comment

Your email address will not be published.

Scroll to Top