# HG changeset patch # User Pavel Ryapolov # Date 2013-08-13 06:51:12 # Node ID 6af33f1b4afc324664faa053137912eb2e0d9b9e # Parent fc19fce9090a2390d499910f8ebf764a533641f6 Setting focus to text area after reply. diff --git a/boards/static/js/thread.js b/boards/static/js/thread.js --- a/boards/static/js/thread.js +++ b/boards/static/js/thread.js @@ -81,12 +81,14 @@ function moveCaretToEnd(el) { function addQuickReply(postId) { var textToAdd = '>>' + postId + '\n\n'; - $('#id_text').val($('#id_text').val()+ textToAdd); + var textAreaId = '#id_text'; + $(textAreaId).val($(textAreaId).val()+ textToAdd); var textarea = document.getElementById('id_text'); + $(textAreaId).focus(); moveCaretToEnd(textarea); - $("html, body").animate({ scrollTop: $('#id_text').offset().top }, "slow"); + $("html, body").animate({ scrollTop: $(textAreaId).offset().top }, "slow"); } $(document).ready(function(){