1<input type="text" id="Search" value="Hello" />
2
3var searchInput = $('#Search');
4
5// Multiply by 2 to ensure the cursor always ends up at the end;
6// Opera sometimes sees a carriage return as 2 characters.
7var strLength = searchInput.val().length * 2;
8
9searchInput.focus();
10searchInput[0].setSelectionRange(strLength, strLength);