Skip to content

Commit

Permalink
Reset the features search result when click on x button
Browse files Browse the repository at this point in the history
  • Loading branch information
hishamco committed Jan 11, 2025
1 parent a2f45e5 commit f51274c
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
</form>
<script at="Foot">
$(function () {
const EscapeKeyCode = 27;
var searchBox = $('#search-box');
// On each keypress filter the list of features
Expand All @@ -188,7 +189,7 @@
var elementsToFilter = $("[data-filter-value]");
// On ESC, clear the search box and display all features
if (e.keyCode == 27 || search == '') {
if (e.keyCode == EscapeKeyCode || search == '') {
searchBox.val('');
elementsToFilter.removeClass("d-none first-child-visible last-child-visible");
} else {
Expand Down Expand Up @@ -227,6 +228,14 @@
}
});
// this function will be executed on click of X (clear button)
searchBox.on('search', function () {
var e = $.Event('keyup');
e.keyCode= EscapeKeyCode;
searchBox.trigger(e);
});
$(".dropdown-menu a").filter(function () {
return $(this).data("action");
}).on('click', function () {
Expand Down

0 comments on commit f51274c

Please sign in to comment.