created method to create dom elements in memory