Mike, I don't like breaking the chains... I just insert a debug in the
middle of the chain...

I use this for my debug:
jQuery.fn.debug = function(message) {
        return this.log('debug:' + (message || '')
+"[").each(function(){jQuery.log(this);}).log("]");
}
jQuery.fn.log = jQuery.log = function(message) {
        if (!message) message = 'UNDEFINED'
        if (typeof message  == "object") message = jsO(message)
        if(window.console && window.console.log) //safari
                window.console.log(message)
        else if(window.console && window.console.debug) //firebug
                window.console.debug(message)
        else
                jQuery("body").prepend(message+ "<br/>")
        return this
}


On 1/23/07, Michael Geary <[EMAIL PROTECTED]> wrote:
> > Is there a way to just return the jquery object (so I could
> > see it in firebug's watch section) then pass it to another
> > jquery function then join them all up when I know
> > everything works?
> >
> >      $('#test :textarea').before('Current length:&nbsp;<span id="'+
> this.id +'_len">'+this.value.length+'</span>&nbsp;characters').keypress(
> function()
> >     {
> >          $('#'+this.id + '_len').css('color', ((this.value.length >
> parseInt(this.id.split()[1]))?'red':'green')).html(this.value.length)
> >      });
>
> Yes, breaking up your chains is one of the first things do do when you're
> having trouble. For example:
>
>     var $test = $('#test :textarea');
>     $test.before('Current length:&nbsp;<span id="'+ this.id
>         +'_len">'+this.value.length+'</span>&nbsp;characters');
>     $test.keypress( function() {
>          var $len = $('#'+this.id + '_len');
>          $len.css('color', ((this.value.length >
> parseInt(this.id.split()[1]))?'red':'green'));
>          $len.html(this.value.length);
>      });
>
> Now you'll find it easier to debug.
>
> -Mike
>
>
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>


-- 
Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to