However, .triggerHandler() is documented to only call the handler for
the first element in the jQuery object. The .andSelf() adds the $
(this) to the end of the object. If you click star 3 and the click
handler is this:
$(this).nextAll('a').andSelf().removeClass
('star_selected').triggerHandler('
The 'click' part of your code seems to work fine. I couldn't test the
rest, but prevAll (you've got a typo there) and nextAll + andSelf are
always returning the correct elements. Use Firebug, set console.log( $
(this).preAll('a').andSelf().addClass('star_hover') ) inside the
handler and you'll se
Ricardo,
Sorry, but it is a development stage I am not permitted to share. But
the markup is this (basically):
HTML (this was a select menu that gets converted to a hidden field and
5 tags in an earlier step)
1
2
3
4
5
JS:
var r = $('#the-rating'); /* THE HIDDEN FIELD STORES RATING */
$('a.
Do you have a test page we can look at?
nextAll returns an empty object if there is no 'next', but it doesn't
interrupt the chain, there may be something else going on. I couldn't
reproduce your situation here, nextAll().andSelf() returns me the
original element.
- ricardo
On Dec 12, 10:39 am,
Paul,
Thanks for the reply. I do not wish to use a container here, if I can
help it, but I do have a unique class name to hook onto, and your
solution works just fine with it. So my code became:
$('a.star:gt(' + ($("a.star").index(this)-1) + ')').removeClass
('star_selected').triggerHandler('mou
Hi Michael,
Try this. It uses the index of the within the and then
removes the class from all elements equal or greater than it.
The code is a bit cumbersome but I think it works.
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
$('#links a').click(function(){
$('a:gt('+($("#li
6 matches
Mail list logo