ok, I have a text box that has some AJAX search_suggest built into it. When you click on a suggestion, the text box is populated with the suggestion that was clicked and the focus is also sent back to the text box. However, it is going to the begining of the text and I would like for it to go to the end of the text. Code follows...
It works fine in FF, but I need for it to work in IE6 and IE7
Any suggestions??
Code:
//Click function
function setSearch(field, value,div) {
var current = document.getElementById(field).value;
if (current.indexOf('\"') == -1 ) {
document.getElementById(field).value = '\"' + value + '\"';
document.getElementById(field).focus();
}
else {
var lastQuote = current.lastIndexOf('\"');
current = current.substr(0,lastQuote + 1);
document.getElementById(field).value = current + '\"' + value + '\"';
document.getElementById(field).focus();
}
document.getElementById(div).innerHTML = '';
}
Any suggestions??