关于光标位置的问题_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 09:45:28
Original
778 people have browsed it

HTMNL JS CHEOME HTML JS

现在有一个div,
there has someting in the div

然后我用document.getElementById("theDiv“).focus(),得到焦点,但是光标会在文本的第一个字符前,如何实现让闪动的光标在文本的最后一个字符后面,求大神指教

回复讨论(解决方案)

在theDiv内套个编辑器不可以吗?光div可能实现不了



    
    <script></script>
    <script> <br /> $(function () { <br /> $("#aa").focus(); <br /> }); <br /> function cc() { <br /> var e = event.srcElement; <br /> var r = e.createTextRange(); <br /> r.moveStart("character", e.value.length); <br /> r.collapse(true); <br /> r.select(); <br /> } <br /> <br /> </script>


    

    

        

    


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template