trying to get 'index' in a collection
in Getting Started
•
5 years ago
I need to use a collection for this feature. I am trying to hide (or remove) the div.form-q element, but can't seem to select it. I have set up a console.log to try to see it's length.
What am I missing here? I know a table would be better suited for this, but I must use this collection.
- /*hide delete file & make dropdown required on additional attachments*/
var uploadFormat = function(){
var i = $(this).index();
var c = $('#q270 div.form-q').legnth;
var descrCell = $('#q270 div:nth-child('+i+')');
$(this).parents('ul').find('.attachmentType select').attr('required', 'true');
descrCell.find('td.delCell').hide();
//find(':button').remove();
console.log(c);
};
$('.addAttachmentUpload .fileuploader').on('updatevalidation', uploadFormat);
$('#q270 .cf-collection-append').click(uploadFormat);
HTML:
My idea is to try to get the number of div.form-q so I can traverse the DOM with the index I get back.
Thanks!
1