Reputation: 11059
I am developing a plugin for jquery and am having a problem to execute methods on it:
$(".data").bindFlexigrid("test")
In my plugin I have:
Plugin.prototype.test = function() {
return "return this!!";
};
Using the debugging tool of Chrome I found that my method is executed normally
As you can see the result is not displayed
The full plugin code in: https://gist.github.com/1725981
The method is in line 141, but the problem with all methods
Upvotes: 1
Views: 37
Reputation: 78640
} else if (typeof options === "string" && options[0] !== "_" && options !== "init") {
return this.each(function() {
By passing "test"
you will hit this if
. return this.each
will return this
which is the jquery object.
return
within the each
has a different meaning.
From the docs:
We can break the $.each() loop at a particular iteration by making the callback function return false. Returning non-false is the same as a continue statement in a for loop; it will skip immediately to the next iteration.
Upvotes: 1