Skip to content

Instantly share code, notes, and snippets.

@liranop
Last active January 30, 2024 15:47
Show Gist options
  • Save liranop/1e0afe261fecf2173866b58c2f77f055 to your computer and use it in GitHub Desktop.
Save liranop/1e0afe261fecf2173866b58c2f77f055 to your computer and use it in GitHub Desktop.
AutoApply JetEngine Date Range (+ hide apply button) 0 do not hide the apply button on settings!
<script>
jQuery(document).ready(function($) {
// Select the input fields and apply button
var fromDateInput = jQuery('.jet-date-range__from');
var toDateInput = jQuery('.jet-date-range__to');
var applyButton = jQuery('.jet-date-range__submit');
applyButton.hide();
// Attach event listener for 'input' on the "from" date field
fromDateInput.on('input change', function() {
// Check if both input fields have values
if (fromDateInput.val() !== '' && toDateInput.val() !== '') {
// Trigger a click on the "Apply" button
applyButton.trigger('click');
}
});
// Attach event listener for 'input' on the "to" date field
toDateInput.on('input change', function() {
// Check if both input fields have values
if (fromDateInput.val() !== '' && toDateInput.val() !== '') {
// Trigger a click on the "Apply" button
applyButton.trigger('click');
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment