diff options
author | Tom Adams <tom@holizz.com> | 2009-08-04 09:22:37 +0100 |
---|---|---|
committer | Tom Adams <tom@holizz.com> | 2009-08-04 09:22:37 +0100 |
commit | 39c420b51fb57f98780d583efaaaebd79de12db9 (patch) | |
tree | 4c355f3917442041e5f49a4b2f929165b317427c /js/util.js | |
parent | 2b00990d27b55644ff133355628f948ddca6df70 (diff) |
Set focus to end of field.
Diffstat (limited to 'js/util.js')
-rw-r--r-- | js/util.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/js/util.js b/js/util.js index d4db8b72a..0409dc601 100644 --- a/js/util.js +++ b/js/util.js @@ -256,10 +256,19 @@ function NoticeReplySet(nick,id) { rgx_username = /^[0-9a-zA-Z\-_.]*$/; if (nick.match(rgx_username)) { replyto = "@" + nick + " "; - if ($("#notice_data-text").length) { - $("#notice_data-text").val(replyto + $("#notice_data-text").val()); + var text = $("#notice_data-text"); + if (text.length) { + text.val(replyto + text.val()); $("#form_notice input#notice_in-reply-to").val(id); - $("#notice_data-text").focus(); + if (text.get(0).setSelectionRange) { + var len = text.val().length; + text.get(0).setSelectionRange(len,len); + text.get(0).focus(); + } else if (text.get(0).createTextRange) { + var range = text.createTextRange(); + range.collapse(false); + range.select(); + } return false; } } |