I personally prefer writing $(document).ready(fn) in full because it is
easier to spot

agent2026 wrote:
> Why wouldn't you use $(fn) here instead of $(document).ready(fn)?
>
> Adam
>
>
>
>
> Karl Swedberg-2 wrote:
>   
>> $(document).ready(function() {
>>    $('#wrapper p').hide()
>>    $('#wrapper h2').filter(':even').css('backgroundColor',  
>> '#ef0000').end().filter(':odd').css('backgroundColor', '#0000ef').end 
>> ().css({cursor: 'hand', cursor: 'pointer', color: '#fff'}).click 
>> (function() {  $(this).siblings('p').slideToggle('slow');  });
>> });
>>
>> Or, to make it more readable:
>>
>> $(document).ready(function() {
>>    $('#wrapper p').hide()
>>    $('#wrapper h2')
>>    .filter(':even')
>>      .css('backgroundColor', '#ef0000')
>>    .end()
>>    .filter(':odd')
>>      .css('backgroundColor', '#0000ef')
>>    .end()
>>    .css({cursor: 'hand', cursor: 'pointer', color: '#fff'})
>>    .click(function() {
>>      $(this).siblings('p').slideToggle('slow');
>>    });
>> });
>>
>>
>> --Karl
>> _________________
>> Karl Swedberg
>> www.englishrules.com
>> www.learningjquery.com
>>
>>
>>
>>     
>
>   

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

Reply via email to