var classes = [ 'class1', 'class2', '...' ]; document.head.insertAdjacentHTML( 'beforeend', '<style>.' + classes.join(',.') + '{display:none !important}</style>' )