When you change the the contents of a div's text with innerHTML in Firefox the cursor behaves strangely. After I change the innerHTML of a div to a new text value the cursor moves to the left of the beginning of the text. Other browsers move the cursor to the right of the end of text. Is there a way to move the cursor or change its behavior and place the cursor to the right of the end of text after I alter the innerHTML value? I tried using setSelectionRange(start, end) and that did not work.
Does the value you assign contains other tags ? If yes then it's better do not use innerHTML, many browsers work incorrect in that case. More reliable to create and attach elements to the tree manually.
I strip the html from all input before I insert it into the div. How could I change the behavior in firefox? I want the cursor always to be at the right of newly added text in a div.