Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- document.getElementById("myTable").addEventListener("click",function(e) {
- // e.target was the clicked element
- if(e.target && e.target.nodeName == "td") {
- // Get the CSS classes
- var classes = e.target.className.split(" ");
- // Search for the CSS class!
- if(classes) {
- // For every CSS class the element has...
- for(var x = 0; x < classes.length; x++) {
- // If it has the CSS class we want...
- if(classes[x] == "classA") {
- // Bingo!
- }
- }
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement