I want detect when user use Entry. I want this, because I want custom the action made by the key. The key will be add a new row on my table. Can you add me please?
Thanks.
EDIT :
This solution don't work. I try all answers and any solution work ... :
<script type="text/javascript">
function stopEntryKey(evt) {
var evt = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if ((evt.keyCode == 13) && (node.type == "text")) {
return false;
$("tbody").html("<tr><td>Item1-col1</td><td>Item1-col2</td></tr>"); // Ajoute une ligne
}
}
document.onkeypress = stopEnterKey;
</script>
EDIT 2 :
$(document).ready(function() {
$(window).keydown(function(event){
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
});
});
This code work. Find here : Prevent users from submitting a form by hitting Enter
Now, I search to add a row when user press the Entry key. Who know how please?