Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function search() {
- const searchText = document.getElementById('searchText').value;
- const towns = document.querySelectorAll('ul> li');
- let count = 0;
- Array.from(towns).map(e => {
- if ((e.textContent).includes(searchText)) {
- e.style.fontWeight = 'bold';
- e.style.textDecoration = 'underline';
- count++;
- } else {
- e.style.fontWeight = '';
- e.style.textDecoration = '';
- }
- });
- document.getElementById("result").textContent = `${count} matches found`;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement