How to Write your own plugins use the tablesorter plugin ?
jQuery Interview Questions and Answers
(Continued from previous question...)
How to Write your own plugins use the tablesorter plugin ?
Find a name for your plugin. Create a file named jquery.[yourpluginname].js.
Adding a Custom Method
Create one or more plugin methods by extending the jQuery object, eg.:
jQuery.fn.yourpluginname = function() {
// do something
};
Which will then be accessible by performing:
$(...).yourpluginname();
Create default settings that can be changed by the user, eg.:
jQuery.fn.yourpluginname = function(options) {
var settings = jQuery.extend({
value: 5, name: "pete", bar: 655
}, options);
};
(Continued on next question...)
Other Interview Questions
|