onChange function not called on change

This code example is intended to illustrate my question in a simple and clear manner. In the actual code, the function is, of course, not empty.