您可以轻松地从站点或任何站点找到 focus() 答案。但是我想知道的是,在我刚刚插入输入框中的内容之后如何使用焦点。
$("input").val('@user').focus(); // this goes to start of the input box and foucs from start, but i want it to focus after the @user
$("input").val('@user today i did new things').focus(5); // i added 5 in focus method, obviously its not supported yet!, but the idea behind is, to focus it after @user from complete word.
编辑:
我刚刚在 Firefox 上看到它工作正常,但在 chrome 中它从开始开始光标。任何解决方案?