I have already a short-hand function like so:
function myObj() {};
myObj.prototype.read = function (name) {alert(name);};
...(more functions)
Now I would like to “convert” this to a jQuery plugin.
What is the best way to do so? (My function doesn’t need a selector before it).
I thought about doing it like this:
$.myObj.methodHere();
Thanks in advance.
Just add your method to the jQuery object.
Then you can call it like:
EDIT: Why do you want to do this? jQuery plugins are supposed to act upon jQuery objects. Your function “doesn’t need a selector before it”, therefore it’s not really a “plugin”.