Mine is in my custom themes folder in a JS sub-folder with the title scripts.js.
(Don't forget to put your file's path in your themes.libraries.yml file. Mine is js:
js/scripts.js: {}
dependencies:
- core/jquery)
OK Here is what goes into your JS file.
$('.your-form').on('submit', function() {
var self = $(this),
button = self.find('input[type="submit"], button');
submitValue = 'Processing...';
button.attr('disabled', 'disabled').val((submitValue) ? submitValue : 'Creating account..');
});
$form['actions']['next'] = [
'#type' => 'submit',
'#attributes' => array("onclick" => "
jQuery(this).addClass('disabled');;"),
'#value' => $this->t('Next'),
'#name' => 'next',
'#ajax' => [
'callback' => '::stepAjaxCallback',
'wrapper' => $wrapper,
],
];