$(document).keypress(function (e) {
if (e.which == 13) {
filtruj();
return false;
}
return false;
});
I want to call filtruj()
whenever the user presses the Enter key and prevent a page submit.
Normally this function is called with click on <a href="#" id="filterButton" onclick="filtruj();" class="t-button t-grid-add">Filtruj</a>
element.
What is happening instead is that I am unable to type anywhere in the form fields.
Remove the last return false
, you are preventing all keys being from being input.
$(document).keypress(function (e) {
if (e.which == 13) {
filtruj();
return false;
}
});