i just want to know about why we need to use jquery widget($.widget) in script because we can also use the script without this jquery widget for requireJS.

any idea, please share.

1 Answer 1


The require() function is AMD's mechanism for specifying and loading dependencies; therefore, we can add one to our app.js file to load the necessary files. The following loads jQuery UI's autocomplete widget.

 require([ "jquery-ui/autocomplete" ], function( autocomplete ) {

When this code executes, RequireJS asynchronously loads jquery-ui/autocomplete.js as well as its dependencies: jQuery core (jquery.js), jQuery UI core (jquery-ui/core.js), the widget factory (jquery-ui/widget.js), the position utility (jquery-ui/position.js), and the menu widget (jquery-ui/menu.js).

All widgets built with the widget factory expose their constructor function when required with AMD; therefore we can use them to instantiate widgets on elements. to understand more about it follow below link

jquery widget

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.