Commit 14b4df48 authored by felix.herrmann's avatar felix.herrmann
Browse files

fix(search): enter key in search input field triggers search, fixes #95

parent 4de06b1b
......@@ -266,6 +266,18 @@ $(document).on('beforeSend.ic', function (event, el, data) {
}
});
var input = document.getElementById("myInput");
$(document).on('keyup','.search-data',function() {
// Number 13 is the "Enter" key on the keyboard
if (event.keyCode === 13) {
// Cancel the default action, if needed
event.preventDefault();
// Trigger the button element with a click
$( ".search-button").click();
}
});
/*
* Attach to any element with .textarea or .textinput class and a maxlength
......
......@@ -13,7 +13,7 @@
<div class="input-group mb-3 search-field-main">
<input class="form-control search-field-main search-middle search-data"{% if query %}value="{{ query }}"{% else %}placeholder="Search"{% endif %} name="q" aria-label="Search">
<div class="input-group-append">
<button class="input-group-text" type="button" ic-include=".search-data" ic-get-from="{% url 'dddatasets:search' %}" ic-target="#content" ic-push-url="true" ic-push-params="q,countries,categories"><i class="fas fa-search"></i></button>
<button class="input-group-text search-button" type="button" ic-include=".search-data" ic-get-from="{% url 'dddatasets:search' %}" ic-target="#content" ic-push-url="true" ic-push-params="q,countries,categories"><i class="fas fa-search"></i></button>
</div>
</div>
......
......@@ -27,7 +27,7 @@
<div class="input-group mb-3 search-field-main">
<input class="form-control search-field-main search-middle search-data"{% if query %}value="{{ query }}"{% else %}placeholder="Search"{% endif %} name="q" aria-label="Search">
<div class="input-group-append">
<button class="input-group-text" type="button" ic-include=".search-data" ic-get-from="{% url 'ddusers:search' %}" ic-target="#content" ic-push-url="true" ic-push-params="q,countries,categories"><i class="fas fa-search"></i></button>
<button class="input-group-text search-button" type="button" ic-include=".search-data" ic-get-from="{% url 'ddusers:search' %}" ic-target="#content" ic-push-url="true" ic-push-params="q,countries,categories"><i class="fas fa-search"></i></button>
</div>
</div>
......
......@@ -11,7 +11,7 @@
<div class="input-group w-25 mx-auto">
<input class="form-control search-top search-data" type="text" {% if query %}value="{{ query }}" {% else %}placeholder="Search"{% endif %} name="q" aria-label="Search">
<div class="input-group-append">
<button class="input-group-text" type="button" ic-include=".search-data" ic-push-url="true" ic-push-params="q,countries,categories" ic-get-from="{% url 'ddusers:search' %}" ic-target="#content"><i class="fas fa-search"></i></button>
<button class="input-group-text search-button" type="button" ic-include=".search-data" ic-push-url="true" ic-push-params="q,countries,categories" ic-get-from="{% url 'ddusers:search' %}" ic-target="#content"><i class="fas fa-search"></i></button>
</div>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment