سؤال

I have a code like this:

$('my-id').select('dd');

But it selects all dd from 'my-id' block. What is the best way to select only several, for example, 4 dd's from my-id?

هل كانت مفيدة؟

المحلول

Use .eachSlice() to break the array into chunks and then take the chunk you want to work with. In the example below it is the first one.

var dds = $('my-id').select('dd').eachSlice(4)[0];
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top