Create a toggle function with javascript.