Posts by Cleo Menezes Junior • 1 point
1 post
-
-3
votes4
answers20028
viewsA: Detect if an element contains a class with pure Javascript
You can do it in a very simple way element.className.endsWith('class-name') Example: const element = document.getElementById('id-name') element.onclick = function() { if…
javascriptanswered Cleo Menezes Junior 1