1

I'm trying to select a particular item from an array in jQuery, and I need to perform some further jQuery processing. Like this:

    $(".checkBoxes").toArray()[i].append($(this).clone());

The object returned from the toArray()[i] does not support append, although if I remove the toArray()[i] then it does support append.

How do I select the i'th element from the array and perform an append on it?

Thanks, S

serlingpa
  • 12,024
  • 24
  • 80
  • 130

1 Answers1

0

Try to use .eq(index) function to get the element from the corresponding index,

$(".checkBoxes").eq(i).append($(this).clone());

Or you can use :eq(index) selector

$(".checkBoxes:eq("+ i +")").append($(this).clone());
Rajaprabhu Aravindasamy
  • 66,513
  • 17
  • 101
  • 130