Solved

Jquery widget vs plugin what is the difference?

Posted on 2012-04-13
4
341 Views
Last Modified: 2012-05-07
What is the difference?
Is one better than the other?
Is there a difference?
0
Comment
Question by:jackjohnson44
  • 2
4 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 37843085
a widget is ready to use
a plugin help you to develop a widget or anything you want.
0
 
LVL 2

Accepted Solution

by:
mdeweerd earned 500 total points
ID: 37845039
A jQuery widget extends the common jQuery UI widget API, normally by using the jQuery Widget factory.
That way of working simplifies the task of extending jQuery for UI interface element/widget.

Some widgets are ready to use (if you take them from the jQuery UI library for instance), but you can also create your own.

A 'plugin' is not limited in its use (you can create more than widgets with it), and you would not be extending the widget base already provided by jQuery.

If using the jQuery Widget is possible, then that is a better solution because the implementation will be more efficient (not as much work to create it).
So you could say that in these cases, a widget is better.
However, you'll need jQuery UI which is an extra library.

Which solution is better, depends on the context.
0
 

Author Comment

by:jackjohnson44
ID: 37851165
Thanks, so is it safe to say that a Widget is a type of plugin which requires jQuery UI?  If I am already using jQuery UI, I might as well use a widget because it does some plumbing for me.
0
 
LVL 2

Expert Comment

by:mdeweerd
ID: 37937730
Hi

A Widget is a general term - it already existed in 1995 (and surely before that).

I agree that the jQuery Widget already does some plumbing for you.  However, it does require you to somewhat understand the extra level of abstraction and the way a widget works.  Once you've understood that, using the widget structure is a great timesaver.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now