开发者

Difference between a jQuery plugin and a jQuery widget? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We ex开发者_如何学运维pect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 9 years ago.

Can someone concisely explain the differences between jQuery plugins and jQuery UI widgets? What are the conceptual differences? Why would I choose one over the other and what pros and cons are there for each. What are the differences in the intention and concept for each?

I've written both, but I'm not clear on the nitty gritty differentiations. I want to make sure I'm choosing appropriately in each case.

Thanks!


Widgets are part of the jQuery UI library, where plugins aren't. Also, the Widgets have a visual component for the GUI, whereas plug-ins don't necessarily (although some do).


jQuery Widgets are better if we need to develop a UI interface that does not need to interact with other functionalities. It is best used if we need to display different content using the same widget as we can optimize using _create and _init.

Plugins are best when we need to implement certain functions in a pipeline fashion one after another.

$(".selector").plugin1().plugin2();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜