[annotator-dev] Data questions

Randall Leeds tilgovi at hypothes.is
Thu Jul 3 15:08:57 UTC 2014


On Jul 3, 2014 4:20 AM, "Ernesto Torresin (ML)" <ewk-ml at connettivo.net>
wrote:
>
> I'm taking note of this... but with annotator 1.2.9 I'm getting that if
> in Firebug console I execute
>
>         var hls = $('.annotator-hl');
>         var hlanns = hls.data('annotation');
>         console.log(hls);
>         console.log(hlanns);
>
> if I have MANY highlights, I only get ONE annotation.
>
> What is the correct way to get ALL the annotations?
>
> TIA
>
> E.T.
> PS hope I'm not making a silly mistake...
>
>

You are, but that's okay.

.data only returns the data for the first in the collection.

You'll need to use one of the methods available in jQuery (or plain
JavaScript) to iterate over the collection and call .data on each one.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20140703/cd39dd15/attachment-0004.html>


More information about the annotator-dev mailing list