Difference between revisions of "Template:Sidebar"
Adelo Vieira (talk | contribs) |
Adelo Vieira (talk | contribs) |
||
Line 345: | Line 345: | ||
$(document).keydown(function(event) { | $(document).keydown(function(event) { | ||
if ( event.ctrlKey ) { | if ( event.ctrlKey ) { | ||
− | if ( event.which === | + | if ( event.which === 66 ) { // Check key codes here: https://css-tricks.com/snippets/javascript/javascript-keycodes/ |
− | // alert(' | + | // alert('Ctrl + B pressed!') |
− | |||
var checkBox = document.getElementById("inputButton"); | var checkBox = document.getElementById("inputButton"); | ||
if (checkBox.checked == true){ | if (checkBox.checked == true){ | ||
Line 354: | Line 353: | ||
checkBox.checked = true | checkBox.checked = true | ||
} | } | ||
− | |||
myFunction() | myFunction() | ||
− | |||
e.preventDefault() | e.preventDefault() | ||
} | } | ||
Line 362: | Line 359: | ||
}); | }); | ||
+ | // Esta es otra forma de hacerlo | ||
// document.addEventListener("keydown", function(event) { | // document.addEventListener("keydown", function(event) { | ||
// if (event.ctrlKey && event.code === "KeyB") { | // if (event.ctrlKey && event.code === "KeyB") { |
Revision as of 12:26, 9 March 2021