Skip to content

Commit

Permalink
Enable support for return key inside Pagy compact input (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
cseelus authored and ddnexus committed Jun 10, 2018
1 parent dc19f57 commit 8c20fa2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/pagy/extras/javascripts/pagy-compact.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,12 @@ function PagyCompact(id, marker, page){
}
};

input.addEventListener("focusout", this.go);
// jump to page number from input when input looses focus
input.addEventListener('focusout', this.go)
// … and when pressing enter inside input
input.addEventListener('keyup', function (e) {
if (event.which === 13) {
this.go()
}
}.bind(this))
}

0 comments on commit 8c20fa2

Please sign in to comment.