Bu cevap, konu sahibi tarafından kabul edilebilir bir cevap olarak işaretlendi.
buton varsa, "removeChild" ile bu butonu kaldır. Eğer buton yoksa, "createElement" ile yeni bir buton oluştur ve "appendChild" ile bu butonu ilgili div içine ekle.
Javascript ile yukarıdaki temel adımları takip ederek bunu yapabilirsin hocam.