I want to show a tooltip on the button as long as the search field is empty.
what I have tried:
// hover feature
const searchBtn = document.querySelector('.find__btn');
searchBtn.addEventListener('mouseover', () => {
const searchText = document.querySelector('.find__field');
console.log(searchText.value);
if (searchText.value.length === 0) {
jQuery(searchBtn).tipso({
titleContent: 'Hello',
});
}
});
the problem with this implementation is it works only the first time. I mean, if I write something in the search field and hover over the button the tooltip is not visible and that is what I want. but the problem is If I make the search field empty and hover over the button, the tooltip is not visible.
so, it works only the first time. how can I fix it?