Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Set cursor positon in WebHTMLEditor
posted

I have added a javascript function to a custom button in the WebHtmlEditor which adds a logged on users name and the date and time as a time stamp using the insertAtCaret function.

Is there a way to move the caret to the end of the text before doing the insert? 

Thanks

Paul 

 

Parents Reply
  • 265
    posted in reply to [Infragistics] Viktor Snezhko

    Yes, this does work if the text inside the editor is plain text, but in my case its combination of normal text [email id, user types in] and htmltext.

    I am loading the below content on page load, and calling javascript function onfocus event of the editor. The result is the selection of a span control which is somewhere in the middle, but not at the end. I tried different methods of textrange object[move, moveend, movestart etc., nothing seems to work ] Please check the screenshot.

     

    webHtmlEditor1.Text =  "<span id='I_1' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 1</span>; <span id='I_2' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 2</span>; <span id='I_3' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 3</span>; <span id='I_4' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 4</span>; <span id='I_5' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 5</span>; <span id='I_6' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 6</span>; <span id='I_7' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 7</span>; <span id='I_8' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 8</span>; <span id='I_9' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 9</span>; <span id='I_10' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 10</span>; <span id='I_11' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 11</span>; <span id='I_12' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 12</span>; <span id='I_13' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 13</span>; <span id='I_14' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 14</span>; <span id='I_15' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 15</span>; <span id='I_16' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 16</span>; <span id='I_17' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 17</span>; <span id='I_18' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 18</span>; <span id='I_19' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 19</span>; <span id='I_20' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 20</span>; <span id='I_21' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 21</span>; <span id='I_22' title='Select to Delete.' contentEditable='false' unselectable='true' style='color:#00589F'>Dummy 22</span>; " ;

     

Children