Hey guy's need help ? JQuery

I have set dynamically attribute to the checkbox “data-index” I want read that index into jQuery but i get undefined, can you Please help me.

var formWrapper =jQuery('.sendData').parents('.form-group');
	formWrapper.find("input[type=checkbox]:checked").val();
	jQuery.each(formWrapper.find('input[type=checkbox]:checked'),function(i){
			    console.log(jQuery(this).parents(".checkbox").data('data-index'));
				 // val[i] = jQuery(this).parents(".checkbox").attr('data-index');
				 val.push(jQuery(this).parents(".checkbox").attr('data-index'));

			});

what’s wrong i am doing …

if you provide your whole code it’s much easier to help you

Thanks for reply, I have solved this issue myself.