so I am very new to jQuery, so I apologize if this is a dumb question, but
I've coded up an element like this:

<p class="comments-count" id="comments-count-3" 
onclick="javascript:jQuery('#comments-count-3').toggle(function(){jQuery('#comments-count-3').addClass('makered')},function(){jQuery('#comments-count-3').removeClass('makered')});
jQuery('#comments-body-3').slideToggle(400)" style="cursor:pointer;">5
comments</p>

I know that's hard to read, I have to put the jQuery in the markup, because
the numbers in the ids are generated by PHP in a loop.

Anyway, the toggle function works (by adding a class called "makered" to the
id, in this case #comments-count-3") but it only works every OTHER click,
and only starts working after three clicks.  

(the second jQuery function, the slideToggle on the other element, works
perfectly)

If anyone could shed light on this, I would appreciate it.  
-- 
View this message in context: 
http://www.nabble.com/problem-with-toggle-function-tp18098246s27240p18098246.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to