You cannot put it in Client/Startup Script directly because the editors are not created yet. You may wait until the form is initiated, e.g. in Startup Script
currentForm.on("initiated", () => { ... your code ... }); // This example assume normal pages such as the Add/Edit page of a table