ボタンを押した後にボタンのテキストを変更する簡単なタスクがあります。これが私のスクリプトです:
$(".recent").on("click", 'button', function () {
$(this).closest($("li")).find($(".content")).slideToggle();
if ($(this).text="Show content") {
$(this).text("Hide content");
} else {
$(this).text("Show content");
}
});
ボタンを押すと、テキストが「コンテンツを非表示」に変わります。しかし、ボタンをもう一度押すと、「コンテンツを表示」に戻りません。簡単なことだと思います...助けていただければ幸いです。