Would anyone have any idea how to make a Find and Replace thing where when you can just click next it will bring you to the next found item?
Edit:
For an Textarea. I want a Javascript code that can add a Find and Replace to Textarea. I don’t wanna just use.
search()
or Replace().
At the Moment im trying this:
function allIndexes() {
var indices = new Array();
var index = 0;
var i = 0;
while(index = $('#text').val().indexOf($('#search').val(), index) > 0) {
indices[i] = index;
i++;
}
return indices;
}
But that doesn’t work at all.
I updated my earlier answer and finished the search and replace functionality based on the direction my earlier post outlined. I tested this in Chrome 14, IE8 and Firefox 3.6.
Find: will select the next instance of the searchterm.
Find/Replace: will replace the next occurrence of the search string and select the replacement
Replace All: will replace all occurences and select the piece of text that has been replaced last
Hope this is now, what you were looking for. You should definitely be able to go from here and style this or make a proper class out of this…