Ajax not getting triggered on change event of selectbox field I've tried all options to trigger an ajax event on change of a selectbox option inside form alter hook, but nothing works. Below is the sample code
$form['field_select_box']['#ajax'] = 
   [
     'callback' =&gt; 'toggleOptions', 
     'event' =&gt; 'change', 
     'wrapper' =&gt; 'edit-field-target'
   ];

If I just try to attach the ajax event to a simple text field (like title), it WORKS.
$form['title']['widget'][0]['value']['#ajax'] =
  [
    'callback' =&gt; 'updateSubdomain',
    'disable-refocus' =&gt; FALSE,
    'event' =&gt; 'change',
    'wrapper' =&gt; 'edit-field-subdomain-0-value',
  ];

Help is appreciated
For select list, the ajax should be
$form['field_select_box']['widget']['#ajax'] = [
  ...
];

and please try to code as Drupal standard.