在 asp.net 核心中隐藏和显示按钮点击文本

Hide and show text on button click in asp.net core

我正在创建一个带有 API 的网络应用程序,并使用 HTML 编写了某种帮助页面。 为了清楚起见,我想在单击按钮时隐藏和显示一些文本。

我已经得到了 HTML 代码。

<li> GET https://someurl.com/api/getallInformation - some text about data</li>
<div>
    <button onclick="help()">Show Text</button>
</div>
<div id="Text">
    <li>Text that should be shown and hidden on Button click </li>
</div>

但我不知道如何编写 help()-function 让按钮工作。我正在 ASP.NET Core 中编写应用程序。 我知道有很多例子,但我发现的 none 似乎符合我的问题。 知道怎么做吗? Thats what it looks like now. The button just does not work.

function help() {
  var x = document.getElementById("Text");
  if (x.style.display === "none") {
    x.style.display = "block";
  } else {
    x.style.display = "none";
  }
}
<button onclick="help()">Help</button>

<div id="Text">
<li>Text that should be shown and hidden on Button click </li>
</div>