diff --git a/Client-Side Components/Client Scripts/ Improve UX by focusing on the first editable field when a form loads./README.md b/Client-Side Components/Client Scripts/ Improve UX by focusing on the first editable field when a form loads./README.md new file mode 100644 index 0000000000..2b2c4c6ac9 --- /dev/null +++ b/Client-Side Components/Client Scripts/ Improve UX by focusing on the first editable field when a form loads./README.md @@ -0,0 +1 @@ +This client-side script automatically sets focus to the first visible input field when a form loads, improving user experience and reducing clicks diff --git a/Client-Side Components/Client Scripts/ Improve UX by focusing on the first editable field when a form loads./client.js b/Client-Side Components/Client Scripts/ Improve UX by focusing on the first editable field when a form loads./client.js new file mode 100644 index 0000000000..4223435069 --- /dev/null +++ b/Client-Side Components/Client Scripts/ Improve UX by focusing on the first editable field when a form loads./client.js @@ -0,0 +1,4 @@ +var inputs = document.querySelectorAll('input:not([type=hidden])'); + if (inputs.length > 0) { + inputs[0].focus(); + }