Set textarea selection in Internet Explorer

前端 未结 4 714
灰色年华
灰色年华 2020-12-05 15:23

I\'m looking for a way to set a selection in a textarea in Internet Explorer. In other browsers, this works just fine:

textarea.selectionStart = sta         


        
4条回答
  •  余生分开走
    2020-12-05 16:05

    This works for me:

    
    
    
    

    Useful links:

    • http://help.dottoro.com/ljlwflaq.php
    • http://www.webreference.com/programming/javascript/ncz/
    • http://www.quirksmode.org/dom/range_intro.html

    moveStart() at MSDN: http://msdn.microsoft.com/en-us/library/ms536623%28VS.85%29.aspx

    moveEnd() at MSDN: http://msdn.microsoft.com/en-us/library/ms536620%28VS.85%29.aspx

提交回复
热议问题