Marc Jansen schrieb:
> Hi list,
>
> OK. So then it seems to be in the newsticker-plugin used on this site:
> www.rsv-arloff-kirspenich.de
> I checked it: I changed this lines:
>
> $(document).ready(
> function()
> {
> $("#news").newsTicker(5000).end();
> }
> );
>
> to:
>
> $(document).ready(
> function()
> {
> $("#news").newsTicker(5000);
> }
> );
>
> And the error was gone, while the newsticker itself provides the full
> functionality. So, what is "end()" about? Do I really need it when I'm
> not using the '$'-function afterwards again?
>
> --Marc
Interesting. Like I said...
I think that should be filed as a bug. Calling end() too much should
degrade gracefully and not result in an error.
What does end do?
In jQuery there are certain functions that alter the original jQuery
object, like parent(), prev(), next(), find().
var $div = $('div');
$div.find('p');
In the second line the jQuery object has been altered, it contains p
elements instead of divs now.
If you want to return to the old query you have to use end():
$div.end();
This is handy if you want to do a lot of operations in one chain
including children, for example attaching two different click handlers
to two links:
$('div').find('a').eq(0).click( ... ).end().eq(1).click( ... );
It's like traversing back to an earlier query...
From looking at the source you provided, I'd say the end() there is
useless and you can safely remove it.
-- Klaus
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/