How to refresh div, keeping the cursor in the form field?

I'm not strong in the front and can't solve a problem with the page refresh, but the cursor remained in the shape field.

Using ajax or jquery can I update the page, but to make the cursor was in the textarea I can't. I tried finding the element by class name or id to call focus() and select(), but it does not bring result.

How can I refresh a specific div without refreshing the whole page? Or maybe there is some other solution?

Thank you

Code html
the <body>

 <div id="messages">
 {% for message in messages %}
 <p>{{message[0]}} : {{message[1]}}</p>
 {% endfor %}

 <div class='message-form'>
 <form method="post">
 <p><textarea name="message" id="mess"></textarea></p>
 <input type="submit" name="submit" value="Submit">

April 7th 20 at 10:44
1 answer
April 7th 20 at 10:46
Add this to the tag: autofocus
Thank you for help. Updating content too - Lenora93 commented on April 7th 20 at 10:49
@Lenora93, Great! - declan.Corke commented on April 7th 20 at 10:52

Find more questions by tags AJAXJavaScriptjQuery