Please don't forget that a noob started this thread ;) How do I use that
code block?
Ⓙⓐⓚⓔ wrote:
>
> 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: <span id="'+
>> this.id +'_len">'+this.value.length+'</span> 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: <span id="'+ this.id
>> +'_len">'+this.value.length+'</span> 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
>> [email protected]
>> http://jquery.com/discuss/
>>
>
>
> --
> Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>
--
View this message in context:
http://www.nabble.com/What-tools-should-I-use-to-troubleshoot-jquery-problems--%28John-Resig%2C-jquery-team%2C-other-gurus-please-share-your-tricks...%29-tf3066235.html#a8552883
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/