Set focus on a div after form is submitted
Hello all,
I've been working with a fairly simple contact form that emails info to a client when it's submitted. within the <form></form> tags, i have <div id="response"></div> which is where my "success" or "fail" messages appear after the form is submitted.
I would like to set the focus on that div after the form is submitted but can't seem to work out how to do that.
So far i have tried adding
- onSubmit="$('form #response).focus();
to the form, but it isn't doing anything.
I've also tried:
- <script type="text/javascript">
- $('#agent').submit(function() {
- $('#response').focus();
- });
- </script>
where #agent is the form's ID but that doesn't seem to work either.
Can anyone point me in the right direction?
Thanks in advance,
Jason