Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve() {
- const tBodyEl = document.querySelectorAll('tbody tr');
- document.getElementById('searchBtn').addEventListener('click',handler);
- const sText = document.getElementById('searchField');
- function handler(){
- [...tBodyEl].map(x=>x.classList ='');
- [...tBodyEl].forEach(e => {
- const text = e.textContent;
- if (text.includes(sText.value) && sText.value !== '') {
- e.className = 'select';
- }
- });
- sText.value = '';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement