Hidden until-found

by Sova

HTML

<div id="box" hidden="until-found">
  text
</div>

<button id="btn">
  Reset
</button>

JavaScript

const box = document.getElementById('box');
const btn = document.getElementById('btn');

box.addEventListener('beforematch', e => {
  console.log('beforematch', e);
  box.textContent = 'found';
});

btn.addEventListener('click', () => {
  box.hidden = 'until-found';
  box.textContent = 'text';
});