Showing posts with label set cursor in end of the word in textbox firefox issue. Show all posts
Showing posts with label set cursor in end of the word in textbox firefox issue. Show all posts

Monday, July 7, 2008

set cursor in end of the word in textbox firefox issue

js:-

function SetEnd(textBox)
{
if (textBox.createTextRange)
{
var fieldRange = textBox.createTextRange();
fieldRange.moveStart('character', textBox.value.length);
fieldRange.collapse();
fieldRange.select();
}
}
C#:-

HttpBrowserCapabilities httpBrowserCapabilities = new HttpBrowserCapabilities();

httpBrowserCapabilities = Request.Browser;

if (httpBrowserCapabilities.Browser != "Firefox")
{
searchTextBox.Attributes.Add("OnFocus", "SetEnd(this)");
}