PreventDefault should override the original functionality that the browser uses to display the bookmarks and you can then execute your logic following that. You can find an article
here with further details on using Javascript to handle these type of events.
mnmagri
Member
79 Points
29 Posts
Intercept Ctrl+J in textbox
Apr 17, 2012 05:06 PM|LINK
Hello all,
I'm working with a barcode reader, and after all input, it sends a CR and a CTRL+J, which open the bookmarks window.
Is there anyway of intercepting (and avoiding) this behavior? Reconfigure the barcode for CR only or TAB, unfortunately, is not an option.
Thanks in advance for any help,
Marcelo
www.eopreco.com.br - want to save some money? Find the lowest price here.
Rion William...
All-Star
27894 Points
4616 Posts
Re: Intercept Ctrl+J in textbox
Apr 17, 2012 06:06 PM|LINK
You should be able to handle this using Javascript:
<script type='text/javascript'> document.getElementById('yourBarcodeInputId').onkeydown = function(e){ //If CTRL+J is pressed... if(e.ctrlKey && e.keyCode == 'J'.charCodeAt(0)) { //Prevent Default (Bookmark Display) from occurring e.preventDefault(); //Handle your CTRL+J functionality here... } } </script>Working Demo
PreventDefault should override the original functionality that the browser uses to display the bookmarks and you can then execute your logic following that. You can find an article here with further details on using Javascript to handle these type of events.
mnmagri
Member
79 Points
29 Posts
Re: Intercept Ctrl+J in textbox
Apr 19, 2012 04:58 PM|LINK
Thanks a lot, worked like a charm.
www.eopreco.com.br - want to save some money? Find the lowest price here.
Rion William...
All-Star
27894 Points
4616 Posts
Re: Intercept Ctrl+J in textbox
Apr 19, 2012 05:01 PM|LINK
Glad it helped you out :)