Change event only fires once

Change event only fires once

Hi, I am a seasoned PHP developer and I'm also very familiar with xhtml and css.  I've been playing with jQuery for a couple months and to this point it has been pretty easy to pick up.  However, I have run into my first roadblock and I'm hoping someone is able to lend a hand.


I have a series of checkboxes on a page and the goal is to run an ajax post each time one of the checkboxes is checked.  When the page loads, the first time I click each of the checkboxes everything goes as planned.  After I receive the response from my ajax php function and all related events fire, I click the checkbox again and nothing happens.  The event listener seems to have stopped functioning.


Here is my code:


  1. $(document).ready(function() {
  2. $(':checkbox').change(function() {
  3. $(this).attr('disabled','disabled');
  4. $('#' + $(this).attr('id') + 'Waiting').addClass('loading');
  5. $.post('/ajaxSettings/',{ f: $(this).attr('name'), v: $(this).attr('checked') == true ? 'on' : 'off' }, function(data) {
  6. $('.loading')
  7. .removeClass('loading')
  8. .html(data)
  9. .fadeOut(2000);
  10. });
  11. $(this).attr('disabled','');
  12. });
  13. });


Thanks for any assistance you are able to provide.