On Dec 11, 2008, at 3:42 PM, ksun wrote:
I tend to rewrite stuff a lot with Jquery, I guess thats part of the
learning.

me too. it's both educational and fun! :)

<script>
$(document).ready(function()
{
 $(':checkbox').click(function(){
        if(this.checked)
                $('#showtime').show();
        else
                $('#showtime').hide();
 });
});


Here's another way to write this:

$(document).ready(function() {
  $(':checkbox').click(function() {
    $('#showtime')[this.checked ? 'show' : 'hide']();
  });
});

not necessarily better. but more compact.


--Karl
____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com

Reply via email to