Changing class name and dom elements initialised outside class