Solved

Jquery widget vs plugin what is the difference?

Posted on 2012-04-13
4
347 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
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…

776 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