Reputation: 87
I have this jquery and form and I want to be able to exclude certain keystrokes from triggering the search action. Is there an easy way to just allow e.g. alpha numeric keystrokes? So I can disregard, ctrl, shift keys etc...
$(function() {
var $searchField;
return $searchField = $('.search');
});
$searchField.focus().val($searchField.val());
$(document).on("keyup", ".search", function(e) {
return delay(function() {
$('.search').attr('readonly', 'readonly');
return $('.search').parent('form').submit();
}, 500);
});
<form accept-charset="UTF-8" action="/" method="get">
<input class="search" focus="true" id="search" name="search" placeholder="Search" type="text" value="">
</form>
Upvotes: 0
Views: 61