1

I have quite a curious case, regarding jquery and html. The HTML code for page is, as follows

<button id="button" type="button" onclick="doSmth()" accesskey="A"><u>A</u>ction</button>

and whenever i click accesskey - everything works just fine.

But - when I've tried to do exactly the same, just using the jQuery - simply adding

$(document).on("click","#button", doSmth)

and removing the "onclick" attribute of button - the page started to malfunction.
By saying "malfunction" mean that the click on the button still triggers the script, yet usage of the accesskey doesn't.
Is it just me, or that's the accesskey bug/feature ?

Tom
  • 95
  • 2
  • 9
  • It works fine here: http://jsfiddle.net/7a48mc6o/ Note that I am testing on Chrome for OSX, using CTRL + OPT + A to test. Here's a list of the key chords you need to use to trigger access keys in different browsers, http://en.wikipedia.org/wiki/Access_key#Access_in_different_browsers. It's not just a case of pressing the `A` key alone. – Rory McCrossan Dec 01 '14 at 10:22
  • I'm running win7, it malfunctions in all the browsers - ie 11/10/9, chrome 39 and ff 33.1. And all that my accesskey does - is simply "select"ing the button. //by the way, i know how to use accesskeys, if u think that's the case. – Tom Dec 01 '14 at 10:26
  • @A.Wolff in that case this would appear to be a bug in either jQuery or some browsers. Without thorough testing it would be hard to say exactly where the fault lies. – Rory McCrossan Dec 01 '14 at 10:28
  • @RoryMcCrossan , the "thing" works the same in all the browsers, ie 11/10/9, chrome 39 and ff 33.1. it just selects the button, not clicking it, unlike on jsfiddle. – Tom Dec 01 '14 at 10:30
  • 1
    It worked for me when I changed `$(document).on("click","#button", doSmth)` to `$("#button").on("click", doSmth)` – Manuel Schweigert Dec 01 '14 at 10:52

0 Answers0