Skip to Content
Menu
This question has been flagged
1939 Views

I am trying set hotkey (ctrl + x) to focus input text but it doesn't work.
My code here:

<html>

<input id="text_input" type="search" class="form-control shadow-none" placeholder="Search...."
</input>

<JS>

    Widget.extend({
        template: 'systray_odoo_search.search_icon',           
        events: {
            'keydown': '_onKeydown_searchFocus',
            // 'show.bs.dropdown': '_onActivityMenuShow',
            // 'hide.bs.dropdown': '_onActivityMenuHide',
        },
    _onKeydown_searchFocus: function (e) {
            var self = this;
            if (e.ctrlKey && e.keyCode == 'X'.charCodeAt(0)) {
                self.$('#text_input').focus();
                e.preventDefault();
            }
        },

Avatar
Discard
Related Posts Replies Views Activity
0
Feb 18
2564
0
Sep 17
3205
2
Nov 15
194
1
Feb 24
11103
0
Mar 15
120