var debouncedInputUrl = debounce(function (searchTextUrl) {…
- User
var debouncedInputUrl = debounce(function (searchTextUrl) { $('#search-input').prop('disabled', searchTextUrl !== '');
codeperformSearch("", searchTextUrl, 1); }, 500, true); var debouncedInputTitle = debounce(function () { var searchText = $('#search-input').val().trim(); $('#EnumDropDown').prop('disabled', searchText !== ''); var dropDownValue = $('#EnumDropDown').prop('disabled') ? "" : $('#EnumDropDown').val(); performSearch(searchText, dropDownValue, 1); }, 500, true); $('#search-input').on('keyup', debouncedInputTitle); // Use keyup $('#search-input-url').on('keyup', function () { debouncedInputUrl($(this).val().trim()); }); $('#search-input-url').on('input paste blur', function () { if (!$(this).val().trim()) { $('#search-input').prop('disabled', false); } }); $('#search-input').on('input paste blur', function () { if (!$(this).val().trim()) { $('#search-input-url').prop('disabled', false); } });if one of input is used other disabled
Assistant
It appears you're trying to create a search functionality where the input fields for title and URL are mutually exclusive; when one field is being used, the other should be disabled. However, your current code doesn't quite achieve this because it's disabling the fields based on their own values rather than the value of the other field.
To fix this, you can modify your event handlers to check the state of the other input field when one of them receives input. Here's an updated version of your code that should work as intended: