Skip to content

Commit cd84290

Browse files
Merge pull request #4104 from OpenLiberty/3712_Select_multiple_tags_in_guides
3712_multiple_tag_search_in_guides
2 parents 82c2b03 + 493cebc commit cd84290

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main/content/_assets/js/guides.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,9 +1046,15 @@ $(document).ready(function () {
10461046
showAllCategories();
10471047
});
10481048

1049-
// Click buttons to fill search bar
1049+
// Click buttons to fill search bar
10501050
$("#guides_search_container").on("click focus", ".tag_button", function () {
1051-
var inputValue = "tag: " + $(this).html();
1051+
var clickedTag = $(this).html();
1052+
var inputValue = $("#guide_search_input").val();
1053+
if (inputValue === "") {
1054+
inputValue = "tag: " + clickedTag;
1055+
} else if (!inputValue.includes(clickedTag)) {
1056+
inputValue += " " + clickedTag;
1057+
}
10521058
$("#guide_search_input").val(inputValue);
10531059
$(".tag_button").removeClass("hidden");
10541060
$(this).addClass("hidden");

0 commit comments

Comments
 (0)