Answer the question
In order to leave comments, you need to log in
How to assign the same keyboard shortcut to two elements?
There is this code:
e2_ctrl_navi = function(event) {
if (window.event) event = window.event
var target = (event.srcElement || event.target).tagName;
if (/textarea|input/i.test(target)) return
if (
(document.e2.mac && event.altKey) || (!document.e2.mac && event.ctrlKey)
) {
var link = null
if (37 == event.keyCode) link = document.getElementById('link-prev')
if (39 == event.keyCode) link = document.getElementById('link-next')
if (38 == event.keyCode) link = document.getElementById('link-later')
if (40 == event.keyCode) link = document.getElementById('link-earlier')
if (link && link.href) {
location.href = link.href
if (window.event) window.event.returnValue = false
if (event.preventDefault) event.preventDefault()
}
}
}
id
have different keyboard shortcuts assigned. if (37 == event.keyCode) link = document.getElementById('link-prev')
if (39 == event.keyCode) link = document.getElementById('link-next')
if (39 == event.keyCode) link = document.getElementById('link-later')
if (37 == event.keyCode) link = document.getElementById('link-earlier')
#link-prev
and #link-earlier
must be the same key combination. Likewise for #link-next
and #link-later
. Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question