javascript - On IE cursor is comming always at start in textarea -
i dealing textarea, , on click of calling 1 replace function remove specified string in textarea, basic operation.
expected behavior after clicking on textarea
1) @ first click :
- it should remove specified string textarea
- cursor should come @ end of string
2) more 1 click : - cursor should come @ ever user clicks in text area
below 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 bold. */ $("#"+id).css({"fontweight":"bold"}); $("#"+id).val(newstr); }
assume lang.message specified string.
it's working above behavior ff. facing issue on ie, keep cursor position @ first.
please provide solution....
thanks in adavance pravin
$("#idoftextarea").focus(function() { replace($(this).attr("id"), ""); });
i'm not sure second parameter of replace receiving, i've put empty string in, you'll have fill in yourself.
there's clean , easy code moving cursor end of textarea here.
Comments
Post a Comment