I’m trying to test out using javascript to change some text in a span on my hugo site (using the Relearn theme):
<script src="/js/AI.js"></script>
<h2>
Welcome
</h2>
<p> There is as of yet no functionality here, this is for testing!</p>
<form method= "POST" action = "" enctype="multipart/form-data">
<label for="query">Enter Query: </label>
<input type="text" id="query" name="query"><br>
<button onclick="test()"> Submit </button>
</form>
<span id="response"> </span>
function test() {
document.getElementById("response").innerText = "Testing 123"
}
I can see the ‘Testing 123’ come up on screen, but I then get redirected to a page saying ‘read only’.
I know HUGO is a static site but I have seen it work elsewhere (see: How to Include JavaScript in your Hugo Website or Blog for Cool Applications).
Any suggestions would be appreciated.