Count the number of Array elements in AutoForm

I have the following schema
{ ... 'tags': { type: Array optional: true }, 'tags.$': { type: Object }, tags.$.tag': { type: String max: 10 } }

For my insert form, I want a helper that counts the number of tags currently created. Something like this:
Template.my_template.helpers({ 'number_of_tags': function() { ... Need help with code here. } });

so that I can use the following in my template
`{{ number_of_tags }}

Can’t you just use tags.length? I’ve not used AutoForm but that’s how you get the amount of elements in an array.

I tried the following but it always returns zero:
Template.my_template.helpers({ 'number_of_tags': function() { return $("input[name^='tags']").length } });

I had noticed that all of the input fields took the following form ‘tags.#.tag’ so I thought I could just count them, but apparently not.

Any other ideas?

@Joshig No that doesn’t work.

Any other ideas out there?