Để Add and Remove a class Name javascript, thêm hoặc xóa class trong javascript các bạn sử dụng code sau. Với code thêm hoặc xóa 1 class name trong javascript vô cùng đơn giản như sau: Xóa/Remove 1 class Name bằng JavaScript HTML: function myFunction() { var element = document.getElementById("myDIV"); element.classList.remove("mystyle"); } Demo: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_remove_class Thêm/Add 1 class Name bằng JavaScript HTML: function myFunction() { var element = document.getElementById("myDIV"); element.classList.add("mystyle"); } Demo: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_add_class