I use the code below to update the url link based on user text input:
Right now it works pretty fine when someone clicks the submit button. What I want is to make it also work when a user press the enter button. Fiddle HERE
Answer
Try with this:
$(document).keypress(function(e) {
if(e.which == 13) {
var url = "/tag/";
url += $('#q').val();
window.location = url;
}
});
No comments:
Post a Comment