User
I'm coding a wwebsite and I would like a spinner to be display in the middle of the screen when a button is clicked.
the spinner should be a green circle rotating with silly text messages changing every second below it.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Finally, we'll add the JavaScript to handle the button click and to display random silly text messages:
javascript
let btn = document.getElementById('btn');
let spinner = document.getElementById('spinner');
let sillyText = document.getElementById('silly-text');
let sillyMessages = ["Message 1", "Message 2", "Message 3", "Message 4"]; // Add as many messages as you want
btn.addEventListener('click', function() {
spinner.classList.remove('hide');
setInterval(function() {
let randomIndex = Math.floor(Math.random() * sillyMessages.length);
sillyText.textContent = sillyMessages[randomIndex];
}, 1000);
});
Remember to replace "Message 1", "Message 2", "Message 3", "Message 4" with your own silly messages. This code will now show a spinner when the button is clicked, and it will display a new random silly message from your list every second.