Created
May 13, 2024 03:42
-
-
Save cyberfly/c3d8099fb48bd046ec8cc062fde4686c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form | |
id="keyword_suggestions_form" | |
hx-post="/api/v2/keyword_suggestions" | |
hx-target="#keywords_container" | |
hx-indicator="#loader_container" | |
hx-on:htmx:before-request="emptyDiv('#keywords_container')" | |
hx-trigger="submit[!isFieldEmpty('#seed_keyword')], submitKeywordSearch from:body" | |
> | |
<input type="hidden" name="search_type" id="search_type" value="all_terms"> | |
</form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(".search_type_btn").click(function (e) { | |
let search_type = $(this).attr("id"); | |
$("#search_type").val(search_type); | |
let seed_keyword = $("#seed_keyword").val(); | |
if (!isEmpty(seed_keyword)) { | |
document.body.dispatchEvent(new Event("submitKeywordSearch")); | |
} | |
}); | |
window.isFieldEmpty = function isFieldEmpty(id) { | |
let value = $(id).val(); | |
return isEmpty(value); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment