Hopefully someone can help me.
when im input: "my name is jack".
Ouputput can display change: "my name is clara".
jack change with clara.
but when im input: "my name is toni"
Ouputput still display: "my name is toni"
that text "toni" can't change with "ana"
what's wrong with my code?, this my code
<html>
<body>
Enter Text: <input type="text" id="myText">
<button onclick="myFunction()">Replace</button>
<p id="check"></p>
<script>
function myFunction() {
var x = document.getElementById("myText").value;
var y = x.replace("toni", "ana");
document.getElementById("check").innerHTML = y;
var z = x.replace("jack", "clara");
document.getElementById("check").innerHTML = z;
}
</script>
</body>
</html>
sorry for my bad english
Thankyou...
suziwrong in your codesuzi != ana