Open/close button

I have this toggle button that opens and closes.
It works well, but the text does not change back from “close” to “open” after you first open it and then close it.

How to fix?

s = "<span class='box'>open</span>";
    z.find("a").length > 10 && (z.toggleClass("box_tags"), z.append(s)),
        $(".box").click(function() {
            $(this).parent().toggleClass("box"), "close" == $(this).text() ? $(this).html("open") : $(this).html("close")

A post was merged into an existing topic: Open/close button change text