You don't need Javascript to set accesskey which is just an HTML attribute that automatically generates a keyboard shortcut (e.g. ALT+accesskey or ALT+SHIFT+accesskey).
To do this without modifying existing templates, do it via Replacement Variable Manager (AdminCP > Style > Replacement Variable Manager > Add New Replacement Variable)
For Post and Post Reply buttons:
Search for Text: js-content-entry-submit"
Replace with Text: js-content-entry-submit" accesskey="p"
For Preview button:
Search for Text: js-content-entry-preview"
Replace with Text: js-content-entry-preview" accesskey="r"
Change the accesskey characters as desired.
|