On IE cursor is comming always at start in textarea
Posted
by pravin
on Stack Overflow
See other posts from Stack Overflow
or by pravin
Published on 2010-04-27T10:22:39Z
Indexed on
2010/04/27
10:23 UTC
Read the original article
Hit count: 396
jQuery
|JavaScript
I am dealing with textarea, and on click of this I am calling one replace function which will remove some specified string in textarea, this is the basic operation.
Expected behavior after clicking on textarea
1) At first click :
- It should remove specified string from textarea
- Cursor should come at end of string
2) more than one click : - Cursor should come at where ever user clicks in text area
Below is my replace function....
function replace(id,transFromDb) { newStr = $("#"+id).val(); var len = null; if(transFromDb == '') { newStr = newStr.replace(Lang.Message27,''); newStr = newStr.replace(Lang.Message28,'');
} else { newStr = newStr.replace(Lang.Message28,''); newStr = newStr.replace(Lang.Message27,''); }
/* change font weight as bold. */ $("#"+id).css({"fontWeight":"bold"}); $("#"+id).val(newStr); }
Assume that Lang.Message is specified string.
It's working above behavior with FF. Facing issue on IE, it always keep cursor position at first.
Please provide any solution....
Thanks in Adavance Pravin
© Stack Overflow or respective owner