setFocus=function(id){
var t=$( "#" id).val();
$("#" id).val("").focus().val(t);
}
Put The focus cursor moves to the end of the id text.
After jquery gets focus, the cursor is behind the string. When input gets focus, it automatically moves the cursor to the end of the text content. jQuery uses focus() to focus the text input box and the focus is on the rightmost side of the text. Method
//The cursor is after the string after getting focus
//The principle is to copy and paste yourself again after getting the focus
var t=$("#" id).val();
$("#" id).val(" ").focus().val(t);
Statement: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