$(this).text($(this).text() === "Fold" ? "Unfold" : "Fold"); // if the text equals "Fold", change it to "Unfold"or else to "Fold" $(this).next(".fold-blck").toggle ...
The LHS indicates that g is a function of D variables whereas the RHS indicates that g is a function of only 1 variable.