I took a look at the documentation for plugins authoring and am trying to duplicate the maxHeight plugin shown there, slightly modified, but can't seem to get it to work. I've looked at multiple previous entries about the plugins authoring documentation and still can't seem to get it to work. I'm using JQuery version 1.8.3 and I've put my code on a very simple test page which has only three div's within it. Each div has an "id" attribute defined for it(with values of div1, div2, and div3). Each div also contains an unordered list and each list has a different number of "li" entries in it, when compared with the other two. I also have "jQuery.noConflict()" turned on as well, in the very first liine of the code. Due to the hash mark(#) being a special character which precedes all velocity directives(the primary server-side language for our content management system) I have coded it as "${esc.h}" (which is a good escape character for the hash, in our cms) in the selector coded in the second to last line below. My code looks like this:
var jq = jQuery.noConflict();
(function( jq )
{
jq.fn.maxHeight = function()
{
var htmax = 0;
this.each(function()
{
htmax = Math.max( htmax, jq(this).height() );
alert("MAX=" + htmax + " !...");
});
alert("MAX-HEIGHT FUNCTION ENTERED !...");
return htmax;
};
})(jQuery);
var tallest = jq('${esc.h}div[id]').maxHeight();
alert("TALLEST=" + tallest + " !...");
When it executes the plugin seems to get called just fine, but I'm seeing only the last two alerts shown in the code, and the one inside the ".each()" function is not being displayed at all. If it were working properly I would have expected it to have executed three times. Once for each div on the page.
So I'm trying to figure out why the function coded inside the "this.each(" is not executing properly.
Thanks for the help.