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
[email protected]
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to