I have a form with textbox message and submit button as below
<form action="#" id="messageform">
<textarea name="message" id="message"></textarea>
<input type="submit" value="Send"/>
</form>
And I have ajax to submit form as below.
$("#messageform").submit( function(e) {
e.preventDefault();
});
My problem is I have to manually place cursor at message textarea after clicking submit button. Is there any way to set cursor default on message box . Even after I click on submit button cursor should remain on message textarea .
Just use .focus after click as below:
$("#messageform").submit( function(e) {
e.preventDefault();
$("#message").focus();//this here
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.