Author of: Secrets of the JavaScript Ninja, 1st and 2nd editions, jQuery in Action, 1st, 2nd and 3rd editions, Ajax in Practice, and Prototype and Scriptaculous in Action
It's been years (and years) since I've worked with jQuery but if I recall correctly the .focus() wrapper method may not be doing what you think it does.
It sets a handler for focus events, and it's deprecated to boot.
I think what you want (and this is from memory so details may vary) is to call the element's focus method. So something along the lines of:
That would typically be due to an unclosed parentheses pair, but I'm not seeing such in the code you posted. Are you sure the error is coming from this code fragment?
Some unrelated comments:
If rmaNum is a string, you should be using !== vs !=
Any reason you're not using modern ES6 notation? Unless you're supporting very VERY old browsers (e.g. IE) your code can be simplified and compacted by using arrow functions and template literals.
You can view your local storage in DevTools to see if your set to local storage is working and the value is what you expect. If not, debug how you are setting the value. If so, then it's your local storage fetch that's the issue.
Be aware that all local storage is stored as strings; so if you are trying to store complex structures they need to be serialized. JSON is the usually technique for that.
Use the debugger or console.log to see what each factor in your conditional expressions equates to individually. Make sure that they are all as you expect.
Also, prefer !== and === in comparisons. That way you get xact comparisons without coersions.
Because you want to return data, not a view, you would not use ModelAndView, you'd return an appropriate ResponseEntity, and mark the controller with @RestController.