I am working from the VanDyk / Westgate Pro Drupal Development book
with (working) code below. I have modified it slightly (also below).
My code breaks--that is, the first $('a.targetme') works, but not the $
("a.unit"). I SUSPECT the problem arises because there is NO $
("a.unit") when the document loads. You first must click the $
('a.targetme'). Any thoughts?

Code from Westgate book
=====================
// $Id$

// Global killswitch
if (Drupal.jsEnabled) {
  $(document).ready(function(){
    $('a.plus1-link').click(function(){
      var voteSaved = function (data) {
        var result = Drupal.parseJson(data);
        $('div.score').fadeIn('slow').html(result['score']);
        $('div.vote').html(result['voted']);
      }
      $.get(this.href, null, voteSaved);
      return false;
    });
  });
}

================

// Global killswitch
if (Drupal.jsEnabled) {
        $(document).ready(function(){

        $('a.targetme').click(function(){
      var listUnits = function (data) {
        var result = Drupal.parseJson(data);
                                $('div.units').html(result['units']);
        $('div.units').css('display','inline');
        $('div.units').fadeIn('slow');
      }
      $.get(this.href, null, listUnits);
      return false;
    });

    $("a.unit").click(function(){
        $('a.unit'.css('background','red'));
      var listRes = function (data) {
        var result = Drupal.parseJson(data);
                                $('div.unitres').html(result['unitres']);
        $('div.unitres').css('display','inline');
        $('div.unitres').fadeIn('slow');
      }
        $.get(this.href, null, listRes);
      return false;
    });
  });
}


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to