0

https://github.com/tzuryby/jquery.hotkeys

私のコードは、ID「フォーム」の入力フィールドに焦点を当てる必要があります。

alert("hi"); に変更すると それは機能しますが、フォーカス入力を行うだけでは何もしません...

なぜ?この操作を実行し、キー「ctrl + k」をバインドして入力フィールドにフォーカスするにはどうすればよいですか?

function focusinput() {
    document.getElementById("form").focus();
}

$(document).ready(function(){ 
    $(document).bind('keyup', 'ctrl+k', function() {
        focusinput();
    });
});

</script>

<input id="form" name="form" type="text">
4

0 に答える 0