JS Function: nuButtonLoading();
What it does:
- Adds a loading spinner to a button when clicked
- Disables the button temporarily to prevent double-clicks or further interaction while the background process is running.
- Optionally re-enables the button automatically after a few second. This is useful for handling timeouts or ensuring the button becomes usable again if the process takes too long.
- Works with buttons that have icons, text, or both
- Hides the original icon while the spinner is active
- Cleans up timers and intervals automatically
- Handles buttons being removed from the page mid-process
- Great for buttons that trigger nuBuilder procedure calls or long-running processes
- Prevents users from clicking multiple times by mistake
- Improves visual feedback during operations
You click a "Execute" button — it shows a spinner and disables itself.
(You can add the code directly to the onclick event of the button)
Code: Select all
nuButtonLoading('myButtonId', true);
Code: Select all
nuButtonLoading('myButtonId', true, 15);
Code: Select all
nuButtonLoading('myButtonId', false);