I often see developers add methods to their own jquery Widget by extending the widget object. I'm not certain I really understand why and would appreciate if somebody could explain.
For example, the author(s) of jQuery UI Autocomplete Widget add 2 methods to their widget, why didn't they just have it in the original widget object?
These utility functions don't access any of the widget's internal data, so they don't need to be within the widget function. The names are put into the widget's namespace to prevent polluting the global namespace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With