On 11/02/07, Mike Alsup <[EMAIL PROTECTED]> wrote:
> > all...this is the completed thing...certainly, if people want to crit
> > what I've done here that could be educational...
>
> Hi Vaska,
>
> This is a very active mailing list so sometimes things get missed.
> Good job working out your code.  Some quick comments:
>
> 1.) Inside a plugin 'this' is the jQuery object so you don't need to
> wrap it in $().
> 2.) Some things are easier - and faster - without jQuery, like getting
> simple element attrs.
> 3.) Don't forget the 'var' keyword when declaring variables.
>
> jQuery.fn.tabpost = function(callback) {
>    this.click(function() {
>        var check = this.title;
>
>        // call back will go here eventually
>
>        $('#' + this.parentNode.id + ' li').each(function() {
>            $(this).compare(check, this.title);
>        });
>    });
> }

Or even better (would work if the parent node did not have an id):

jQuery.fn.tabpost = function(callback) {
  return this.click(function() {
      var check = this.title;

      // call back will go here eventually

      $(this).parent().find('li').compare(check, this.title);
  });
}

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to