Custom .js file: auto focus cursor in the login page

themidiman
Community Champion

I've been trying to use jQuery's $.focus() method to trigger the cursor to land in the user id field of the login field of Canvas if it's not already there. When observing various attempts at doing this in the developer console:

$("#pseudonym_session_unique_id").trigger("focus");

$("#pseudonym_session_unique_id").focus()

These all seem to just return the input element itself and I cannot override the default behavior of the page. Is there a simpler way of doing this that I'm overlooking?

Apologies for duplicating this question from this question page: Auto focus cursor in the login page

0 Likes