On enter scroll down to next input field and select it ready to write somthing.

On enter scroll down to next input field and select it ready to write somthing.

I'm hoping this makes sense, but I am building a form and have got a script that so far has disabled submission on enter and scrolls down to the next input field.

However I want that next input field to have the cursor selected and to be ready to start typing.

This is what I have so far;

  1. jQuery('form input').keydown(function (e) {
  2.         if (e.keyCode == 13) {
  3.             var nextQuestion = jQuery(this).closest('.form--wrapper').next();
  4.             if (nextQuestion.length !== 0) {
  5.                 jQuery('html, body').animate({
  6.                     scrollTop: nextQuestion.offset().top
  7.                 }, 1000);
  8.                 jQuery(this).next(':input').select();
  9.             }
  10.             e.preventDefault();
  11.             return false;
  12.         }
  13. });
I tried  jQuery(this).next(':input').select(); but that didn't work and anything else i've tried has made the submission button active again....