In this article, We will learn how to add or remove class using data attributes in jquery after a click…