can't access select on simplerSelectChildCreated event

Created on 19 June 2024, 9 days ago
Updated 24 June 2024, 4 days ago

I try to get select element from event.$wrapper like expose in this change record https://www.drupal.org/node/3221708 but I can only have the label.

I finally found what's get wrong.
The event is trigger before the select is append to the wrapper.
When changing operations order, things get ok.

Changing

      this.$element.trigger(jQuery.Event(`${pluginName}ChildCreated`, { $wrapper }));

      return $wrapper
        .append($select)
        .insertAfter($element);

in

      $wrapper.append($select);
      this.$element.trigger(jQuery.Event(`${pluginName}ChildCreated`, { $wrapper }));

      return $wrapper
        .insertAfter($element);

in build/jquery.simpler-select.js (and build/jquery.simpler-select.js.map and frontend/src/jquery.simpler-select.ts) make it work.

Regards

🐛 Bug report
Status

Needs work

Version

4.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024