-------------------------------------- <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> <script> var lines, randomNumber, lastRandomNumber; $(document.body).ready(function() { $.ajax({url: "https://alceawis.de/Daymusic_array.js"}).done(function(e) { lines = e.replace(/\r\n|\r/g, "\n").trim().split("\n"); if (lines.length) { $("#showLine").on("click", function() { for (; randomNumber === lastRandomNumber && (randomNumber = parseInt(Math.random() * lines.length), 1 !== lines.length);); lastRandomNumber = randomNumber; var line = lines[randomNumber].replace("{'quote': '", "").replace("'},", ""); $("#trivia").html(line); }).trigger("click"); document.getElementById("showLine").style.visibility = "hidden"; } }); }); </script> <button id="showLine">CurrListening</button> <p id="trivia"></p> (source: https://stackoverflow.com/questions/75279944/hiding-button-by-id-works-but-clicking-it-not/75279960#75279944) </plaintext>