I want to completely not allow a user to input any number in a text field, how can I make this work with js? I am trying to replace the numbers with regex but doesn't seem to work
const selectElement = document.querySelector('.ice-cream');
selectElement.addEventListener('change', (event) => {
  const result = document.querySelector('.result');
  let temp = event.target.value.replace(/[^0-9]/g, '');
  result.textContent = `${temp}`;
});
<input type="text" class="ice-cream">
<p class="result">
</p>
I have also tried this
const selectElement = document.querySelector('.ice-cream');
selectElement.addEventListener('change', (event) => {
  const result = document.querySelector('.result');
  let pattern = new RegExp(/[A-Z]/i);
  if(pattern.test(event.target.value)) {
    result.textContent = `${event.target.value}`;
  } else return;
});
It seems not to allow any number at start but when I enter a text and then number then it allows when it shouldn't. Can someone give me advice?