How to toggle class in CDN Version? #481
-
Hello, My Project is vanilla static HTML, and I install Twind By CDN. <button id="btn" class="bg-red-500">Button</button> const btn = document.querySelector("#btn")
btn.addEventListener("click", () => {
btn.classList.toggle("bg-red-500")
}) and I have inspect elements with devtools, and I found the button classname is not the same in my code. <button id="btn" class="#17tpr9i">Button</button> Anyone who know how to toggle class? 🙏 |
Beta Was this translation helpful? Give feedback.
Answered by
rschristian
Jul 20, 2023
Replies: 1 comment 1 reply
-
Twind hashes classnames by default. You can easily configure this however: <script src="https://cdn.twind.style" crossorigin></script>
<script>
twind.install({
hash: false,
});
</script> This disables hashing, so |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
chanayus
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Twind hashes classnames by default. You can easily configure this however:
This disables hashing, so
bg-red-500
will staybg-red-500
.