cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Learner II

Auto focus cursor in the login page

Jump to solution

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?

1 Solution

Accepted Solutions
Highlighted
Navigator

JEFHQ12951​,

Have you tried the pure JavaScript approach?

document.getElementById("pseudonym_session_unique_id").focus();

Until recently (don't know when, but last couple of weeks), Canvas included your local JavaScript within the page itself. Now it is sourcing it from the page. I don't know if that has anything to do with it or not, but now I've got to go back and rethink things.

View solution in original post

7 Replies
Highlighted
Community Team
Community Team

JEFHQ12951​, I'm going to share your question with the Canvas Developers​ and Canvas Admins​ groups to see if members there have had experience with this.

Highlighted

Thanks, stefaniesanders

I was going to do this yesterday but I didn't want to duplicate the question. Has this already been done? I was just in both those group areas and couldn't find the question. If this has been done, could you post the link to it in this thread?

Highlighted

Hi JEFHQ12951​, I did share your question yesterday, but although I can see the @mentions in the activity flow of the aforementioned groups, I don't see any link to the discussion itself in either spot. I'll share it again and follow up to make sure it sticks.

Highlighted

I can now see the shared discussion in both spaces, and for now, I've un-marked the reply as Correct Answer so that it shows up as unanswered in the groups' respective streams.

Highlighted

I re-posted this question myself here: Custom .js file: auto focus cursor in the login page

Highlighted
Navigator

JEFHQ12951​,

Have you tried the pure JavaScript approach?

document.getElementById("pseudonym_session_unique_id").focus();

Until recently (don't know when, but last couple of weeks), Canvas included your local JavaScript within the page itself. Now it is sourcing it from the page. I don't know if that has anything to do with it or not, but now I've got to go back and rethink things.

View solution in original post

Highlighted

Thanks james@richland.edu​, I think this method will work better for us. I can get results from the developer console using this method vs. jQuery which is strange as we've been able to manipulate things on the login page just fine with jQuery before. I wonder what's different?