Last active
January 30, 2024 15:47
-
-
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!
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
<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