Add and remove elements using JavaScript