Skip to content

Commit

Permalink
Multiple search boxes support - fixes #49 (#52)
Browse files Browse the repository at this point in the history
Changes how the searchbox template gets the value of searchbox inputs to permit multiple search boxes on a page.
  • Loading branch information
hunternet93 authored and flaviocopes committed Jul 21, 2016
1 parent 11dc5e9 commit 9a265a4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions templates/partials/simplesearch_searchbox.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
{% endif %}
<script>
jQuery(document).ready(function($){
var input = $('[data-search-input]');
input.on('keypress', function(event) {
$('.search-input').on('keypress', function(event) {
var input = $(event.currentTarget);
if (event.which == 13 && input.val().length >= {{ config.get('plugins.simplesearch.min_query_length', 3) }}) {
event.preventDefault();
window.location.href = input.data('search-input') + '{{ config.system.param_sep }}' + input.val();
}
});
$('.search-submit').on('click', function(event) {
var input = $(event.currentTarget).prev('.search-input');
event.preventDefault();
window.location.href = input.data('search-input') + '{{ config.system.param_sep }}' + input.val();
});
Expand Down

0 comments on commit 9a265a4

Please sign in to comment.