So I ran into a problem here. I have an input, and a paragraph that will hold its value.
All nice and good. But, for example, I want to change the letter "a" let's say with "b". On every occurance. How do I do that? I only got to make it work one time on the first occurance like this:
var input = document.querySelector("input");
var h1 = document.querySelector("h1");
input.addEventListener("input", function(){
h1.innerText = input.value.replace("a", "b");
});
<input type="text">
<h1></h1>
How do I make it replace it on every occurance? And how do I make it replace more than one letter? Like, now if the user pressed the letter "b", replace it with "t" for example, besides the first replacement (a with b).