search.js 439 B

1234567891011121314
  1. const searchInput = $('#search-input');
  2. const searchButton = $('#search-button');
  3. // Checking the search field
  4. function validateSearch() {
  5. if (searchInput.val().trim() === '') {
  6. searchButton.prop('disabled', true); // Disable "Find" button
  7. } else {
  8. searchButton.prop('disabled', false); // Activate "Find" button
  9. }
  10. }
  11. // Input event listener for checking when the field value changes
  12. searchInput.on('input', validateSearch);