I'm trying to create a Find/Replace thing for my text area. I got the find done but I can't get the replace code together.
My search code is:
function setSelectionRange(input, selectionStart, selectionEnd) {
input.focus();
input.setSelectionRange(selectionStart, selectionEnd);
}
function selectString(input, string) {
var match = new RegExp(string, "i").exec(input.value);
if (match) {
setSelectionRange(input, match.index, match.index + match[0].length);
}
}
How would I make a replace function if possible?