Children should be taken to masjids only when the father feels the child will be sensible and could behave decently. It is only than they start understanding how to behave while they are in public. The age of 8yrs is a generally conception that children will be grown enough to understand things. I feel children should be encouraged to visit masjids so that they learn etiquette's fast.