Ctrl+A event on datatables

Ctrl+A event on datatables

sdinesh21sdinesh21 Posts: 37Questions: 0Answers: 0
edited March 2014 in DataTables 1.9
Hi All, Could someone please suggest a solution to bind keydown event on datatables? I want to capture ctrl+a key press, I have tried the following but none of them work.
[code]
$(tblNameId).on('keydown', function(event) {
event.preventDefault();
if (event.ctrlKey && event.which == 65) {
//Event captured
}
}
});

$(tblNameId).on('keypress', function(event) {
event.preventDefault();
if (event.ctrlKey && event.which == 65) {
//Event captured
}
}
});

$(tblNameId).on('keyup', function(event) {
event.preventDefault();
if (event.ctrlKey && event.which == 65) {
//Event captured
}
}
});
[/code]

Replies

  • allanallan Posts: 63,493Questions: 1Answers: 10,470 Site admin
    Try `event.keyCode` rather than `event.which` - although this is more of a generic Javascript question, so you might have better luck on SO or similar.

    Allan
This discussion has been closed.