Hi alex and eric, Sorry, my email was written during a fit of frustration.
Basicly what I mean is as each node is generated on the page there is some PHP that generates the hash Id, then using the drupal_add_js I add the .addClass() function to the head with the class name I want to add, but it seems that jQuery is adding sll the .addClass() to each node. This actually makes sense to me with how jQuery works. So what I need to happen is for each jQuery function that is generated for each .addClass to have a condition that excludes previous nodes that have already been affected. I'm hoping that it runs in order too (I.e. The correct .addClass() affects the correct node). As I typed out this email I had the same idea as Alex (but my blackberry kicked me out of gmail before I could send it) I will try tommorow. Since drupal_add_js allows me to mix PHP variables with jQuery code I could change the I'd selector to be specific to the node I'd (I.e id="node-14", id="node-15", etc) as drupal always automatically generates this. If anyone can think of anything else, it will be appreciated. Tane http://digitalspaghetti.me.uk On 12/4/06, Alex Cook <[EMAIL PROTECTED]> wrote: > If you know the node that is generating the original <script> call, then > why can't you write the id value into the jQuery call? > > Drupal spits out this: > > <script type="text/javascript"> > $(function(){$("[EMAIL PROTECTED]").addClass("microid-d09348e51fc82f053dfd6 > c9c1319ceace8ab83bb")}); > </script> > > For node-14, according to your HTML. > > Change the jQuery to this: > > <script type="text/javascript"> > $(function(){$("div#node-14]").addClass("microid-d09348e51fc82f053dfd6c9 > c1319ceace8ab83bb")}); > </script> > > And then you'd only apply the class to the one node, not every node > found on the page that has the word 'node' in the id field. > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of digital spaghetti > Sent: Monday, December 04, 2006 9:48 AM > To: jQuery Discussion. > Subject: [jQuery] Ignoring tags already affected by .addClass() > > Hey folks, > > I'm making headway with my Drupal module I am working on, but have hit > a problem. > > On the front page of Drupal, I generate a jQuery .addClass() function > for each node that is displayed on the page, and this is fine. For > example, for the first node I get this in my header: > > <script type="text/javascript"> > $(function(){$("[EMAIL PROTECTED]").addClass("microid-d09348e51fc82f053dfd6 > c9c1319ceace8ab83bb")}); > </script> > > <script type="text/javascript"> > $(function(){$("[EMAIL PROTECTED]").addClass("microid-13937db84359a8a64a1ed > 0fd15e671595a9c1207")}); > </script> > > And so on.... > > But now the problem is that rather than just adding one .addClass() to > the node than generates it, it add's ALL the .addClass()'s to every > node. i.e. > > <div id="node-14" class="hentry node > microid-d09348e51fc82f053dfd6c9c1319ceace8ab83bb > microid-13937db84359a8a64a1ed0fd15e671595a9c1207 > microid-75e67f2bf3fd068d30db5534eb5de23d4be42f0d > microid-57d25e482868d5b75fc73de84e953c2ec75b8fea > microid-9b29fa29dc55ce9e538d7fdf580ea114db0f9de3 > microid-58271ed74397cb1eb2ca2838fc69c970e501f782 > microid-982105ca4de63a1bc2458e124fbedae9e151327f > microid-097d71e036b3929e0b0109dc33c5372b4f869132 > microid-45ef47d3e2cc81b3e4f2885768908bda8e17f6f7 > microid-f35ba1ca9de9f35fab601fc9952e6190f45c69dc"> > > is there a way in jQuery to check if a tag has already been touched by > jQuery so it's ignored? I am assuming that as the loop happens on the > front page, jQuery should then assign the correct .addClass() to the > correct node in order? > > Regards, > Tane > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/