Skip to content

Instantly share code, notes, and snippets.

@rwaddin
Created July 4, 2020 07:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwaddin/daef6cc8a9b2d8bd9d6c37a4e0efff01 to your computer and use it in GitHub Desktop.
Save rwaddin/daef6cc8a9b2d8bd9d6c37a4e0efff01 to your computer and use it in GitHub Desktop.
add, remove class javascript
var el = this.$refs[index][0]; // your element
if (el.classList.contains("btn-added")) {
el.classList.remove("btn-added")
el.innerHTML = "order"
}else{
el.innerHTML = "batal"
el.classList.add("btn-added")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment