I want to bind a function to an element on a custom shape [SOLVED]

I need to hook the onchange event of an element on a custom shape.
When I put the following code and precompile it using LaravelMix, I get an error when displaying the chart.
Is there any way to solve this problem?

$(".flow-selector").on(‘change’, function () {
    alert($(this).val());
});

Error is
Uncaught TypeError: n is not a function

This is the known problem. You may workaround it assigning the event handlers after the diagram initialization.
Like:
https://snippet.dhtmlx.com/66mnu374

Thanks for the sample, it solved my problem.

In the dhx.Diagram 3.1.0 update we’ve added the possibility to assign the event handlers to the custom shapes in your diagram.
Now it can be achieved using the eventHandlers property:
https://docs.dhtmlx.com/diagram/common_guides__configuration.html#addingeventhandlersforthecustomshape