I am trying to swap a word from the text to a word of my choice

تبليغ
سؤال

يرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.

تبليغ
‎إلغاء

<!DOCTYPE html>
<html>
<head>
<meta charset=”utf-8″ />
<title></title>
<script>
function replacment() {
let text = document.getElementById(‘text’)
let button1 = document.getElementById(‘text’)
let button2 = document.getElementById(‘text’)
let text3 = text.replace(new RegExp(text1, ‘g’), text2);
document.getElementById(“text”).innerHTML = text3
}
</script>
</head>
<body>
<h1 id=”text”>Steve Jobs was genuis, and many Apple inventions today are result for his great effort, thanks Steve, waw Steve was great.</h1>
<label>search for:</label>
<br />
<input type=”text” id=”button1″ />

<br />

<label>Replace with:</label>
<br />
<input type=”text” id=”button2″ />
<br />
<br />
<input type=”button” value=”Replace”/>
</body>
</html>

I want to be able to swap a word from the text to a new word that I type in the second box.
In the first box I want to type in a word from the text above that will be changed
I am using HTML and JS

‫أضف إجابة

تصفح
تصفح

مجهول يجيب