コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2464 ビュー

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();
            }
        },

アバター
破棄
関連投稿 返信 ビュー 活動
0
2月 18
2994
0
9月 17
3666
2
11月 15
216
1
2月 24
11606
0
3月 15
131