I declared a array variable els = [];
in which I want to store jquery elments which are created at some point within certain events:
els[file.id] = $('<li></li>');
$('body').append(els[file.id]);
file.id is a unique id generated by the plupload script which I'm using (the event is from it)
But it doesnt work, the array is always empty...
Arrays can only have sequential, numeric keys. You can't choose arbitrary keys. To use arbitrary key-value pairs, use an object:
var els = {};
With that said, the code you've written should still work (even though els.length
would be 0) – perhaps this isn't a complete code sample?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With