Take my web page focus to browser address bar using javascript / jquery -


desired behavior : when tabkey press happens on particular dom element in webpage want cursor focus go address bar. (i want via javascript. using browser extension not desired here)

when press control + l shortcut in webpage, takes focus address bar. when try trigger via javascript does'not work.

<div id="1" tabindex="1"></div> <div id="2" tabindex="1"></div> <div id="3" tabindex="1"></div> <script>     var = $('#1');     some.on('keydown', function (e) {         if (e.keycode == 9 /* tabkey */) {             var e = jquery.event("keydown");             e.keycode = 76 /* lkey */;             e.ctrlkey = true;             $('body').trigger(e);          }     }); </script> 

each browser (and operating system) handles differently , not possible highlight address bar using javascript. if was, keep in mind people can map these commands differently (if they're not different already). example, on mac command access address bar command + l, not ctrl + l.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -