I won’t go into the specific idea, it’s more general, and there are comments in the code. The usage method is also self-explanatory, it is a simple global function encapsulation. If you don’t understand, check the comments in the source code or Google.
In addition, for those who are interested , you can try to change an input drop-down list based on this plug-in. The idea is similar, ha.
Demo and code: Demo code Code download
Run code: