Perhaps use .append(labels.join(','))

Note that the snippet from Klaus uses var *labels*, so trying to use
the Array.join method of *levels* (probably undefined) will likely not
work ;)

On Oct 23, 2:58 pm, shapper <[EMAIL PROTECTED]> wrote:
> But I can join the labels can't I?
>
> I tried:
> .append(levels.join(', '))
>
> to added it to an element and I get the error in Firebug:
> levels.join is not a function
>
> Am I doing something wrong?
>
> Thanks,
> Miguel
>
> On Oct 23, 9:57 pm, Klaus Hartl <[EMAIL PROTECTED]> wrote:
>
> > You could try this (untested):
>
> > var labels = $('input:checked + label').map(function() {
> >     return $(this).text();
>
> > });
>
> > That should give you an array with the label's text.
>
> > --Klaus
>
> > On 23 Okt., 22:47, shapper <[EMAIL PROTECTED]> wrote:
>
> > > Hello,
>
> > > This might be a tricky one ... I have been looking into JQuery docs
> > > but I can't figure how to make this.
>
> > > I have the following:
>
> > > <input type="checkbox" name="Roles" id="Admin" value="Admin" />
> > > <label for="Admin">Administrator</label>
>
> > > <input type="checkbox" name="Roles" id="Coll" value="Admin" />
> > > <label for="Coll">Collaborator</label>
>
> > > How can I get, NOT the values, of all checked boxes BUT the label
> > > inner text of all checked boxes?
>
> > > Example:
>
> > > If Coll checkbox is checked I would get:
> > > Collaborator
>
> > > If both checkboxes are checked I would get:
> > > Collaborator, Administrator
>
> > > Could someone, please, help me?
>
> > > Thank You,
> > > Miguel

Reply via email to