I want to focus on a specific text input after submit.
As I googled, lot of answer told me to use $('#id').focus();
But as submit
function refreshes the page, focus() does not react as I expected.
Also setting focus()
on ready function does not help, because it should not focus before submit.
Anyone could help?
You have to focus on the input inside the submit event.
$('#myForm').submit(function(e){
e.preventDefault;
$('#id').focus();
etc...
})
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.