I wish to implement an html accesskey that puts the focus onto the first field within the page.
Is this possible from a generic call.
A typical call using html would be:
<a>Skip to content</a>
NB: I tried adding a "content" div to the html++ part of the Presentation template, but this failed to work.
How to code an accesskey to skip to content
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 201
- Joined: Fri Dec 20, 2013 1:29 pm
- Location: Dartford Borough Council
- Contact:
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
You could do this with an HTML control something like this:
This uses jQuery. Here's a discussion on different ways to find the first editable field on a page including non-jQuery solutions http://stackoverflow.com/questions/277544
You could probably also achieve this with a Hyperlink Control. To make it generic, put this in a component, then just add the component anywhere that you need it.
Code: Select all
<a href="dummy" accesskey="h" onclick="$('input:visible:enabled:first').focus();return false;">skip to top</a>
You could probably also achieve this with a Hyperlink Control. To make it generic, put this in a component, then just add the component anywhere that you need it.
0 x
-
- Ebase User
- Posts: 201
- Joined: Fri Dec 20, 2013 1:29 pm
- Location: Dartford Borough Council
- Contact:
Thanks Jon that did the job nicely
Thanks Jon that did the job nicely
I changed it a bit to read:
onclick="$(':input:enabled:visible:not([readonly]):first').focus();return false;"
which appears to do the job.
I changed it a bit to read:
onclick="$(':input:enabled:visible:not([readonly]):first').focus();return false;"
which appears to do the job.
0 x
Who is online
Users browsing this forum: No registered users and 6 guests