I need a little input on the best way to remove a certain word or phrase in a text area. I have an input field entitled input. I want to search that area for the word that is put into a form field called name and then removed from input. None of the code I have tried works, and most search results yield irrelephant.
function delete() {
var name = document.getElementById("name").value;
var textarea = document.getElementById("input").value;
var data = textarea.length;
for (var i = 0; i < data.length; i++) {
if (textarea.substr(i, data) == name) {
textarea.value = "";
}
}
}
What I tried earlier with no luck.