I have the following JS function which should change the word "hi" to "yo" on a button click if the user has input this. For example "hi, how are you today?" ==> "Yo, how are you today?"
function changeWord() {
let str = document.getElementById('inputBox').innerHTML;
document.getElementById('inputBox').innerHTML = str.replace("hi", "yo");;
}
The above doesn't work when I call changeWord(); on click, any ideas?