```var nextElement = document.getElementsByName('i...
# suitescript
b
Copy code
var nextElement = document.getElementsByName('inpt_assemblyitem');

nextElement[0].focus();
s
this works for me in the console
document.getElementsByName('description')[0].focus()
My guess would something else is drawing the focus after your pageInit call, making it useless
e
I avoid messing with the focus myself, and I have yet to see anyone successfully manage it on a consistent basis
b
Thanks @Sandii and @erictgrubaugh
@Sandii Just a one-liner huh?
Hmmm... I'm using 'assemblyitem' as my field id, but it doesn't appear to be working
Hmm
If I log what is returned by document.getElementsByName... I see this:
Copy code
{
  "0": {}
}
looks like just an empty object
s
If it works... you seem to have had the right id original, the
inpt
one is the one you would want